upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Typedefs
Include dependency graph for enc03r.h:

Go to the source code of this file.

Data Structures

struct  _enc03r_context
 

Functions

enc03r_context enc03r_init (int pin, float aref)
 
void enc03r_close (enc03r_context dev)
 
upm_result_t enc03r_update (enc03r_context dev)
 
upm_result_t enc03r_calibrate (const enc03r_context dev, unsigned int samples)
 
float enc03r_calibration_value (const enc03r_context dev)
 
float enc03r_angular_velocity (const enc03r_context dev)
 
void enc03r_set_offset (const enc03r_context dev, float offset)
 
void enc03r_set_scale (const enc03r_context dev, float scale)
 
float enc03r_get_normalized (const enc03r_context dev)
 

Typedefs

typedef struct _enc03r_contextenc03r_context
 

Function Documentation

enc03r_context enc03r_init ( int  pin,
float  aref 
)

ENC03R sensor constructor

Parameters
pinAnalog pin to use
vrefReference voltage to use; default is 5.0 V
Returns
Device context

Here is the call graph for this function:

void enc03r_close ( enc03r_context  dev)

ENC03R destructor

Parameters
devDevice context

Here is the caller graph for this function:

upm_result_t enc03r_update ( enc03r_context  dev)

Update the internal state with the current reading. This function must be called prior to calling enc03r_angular_velocity().

Parameters
devDevice context
Returns
UPM result

Here is the caller graph for this function:

upm_result_t enc03r_calibrate ( const enc03r_context  dev,
unsigned int  samples 
)

Calibrates the sensor by determining an analog reading over many samples with no movement of the sensor. This must be done before attempting to use the sensor.

Parameters
devDevice context
samplesNumber of samples to use for calibration
Returns
UPM result

Here is the caller graph for this function:

float enc03r_calibration_value ( const enc03r_context  dev)

Returns the currently stored calibration value

Parameters
devDevice context
Returns
Current calibration value

Here is the caller graph for this function:

float enc03r_angular_velocity ( const enc03r_context  dev)

Return the computed Angular Velocity in degrees per second. You must have called encr03r_update() prior to calling this function.

Parameters
devDevice context
Returns
Computed angular velocity

Here is the caller graph for this function:

void enc03r_set_offset ( const enc03r_context  dev,
float  offset 
)

Set sensor offset. The offset is applied to the return value before scaling. Default is 0.

Parameters
devDevice context
offsetOffset to apply to value

Here is the caller graph for this function:

void enc03r_set_scale ( const enc03r_context  dev,
float  scale 
)

Set sensor scale. The return value is scaled by this value after the offset is applied. Default is 1.0.

Parameters
devDevice context
scaleScale to apply to value

Here is the caller graph for this function:

float enc03r_get_normalized ( const enc03r_context  dev)

Get a normalized ADC value from the sensor. The return value will be between 0.0 (indicating no voltage) and 1.0 indicating max voltage (aref). encr03r_update() must be called prior to calling this function.

Parameters
devDevice context
Returns
The normalized reading from the ADC.

Here is the caller graph for this function:

Typedef Documentation

typedef struct _enc03r_context * enc03r_context

Device context