| 
    upm
    1.3.0
    
   Sensor/Actuator repository for libmraa (v1.7.0) 
   | 
 

Go to the source code of this file.
Data Structures | |
| struct | _vdiv_context | 
Functions | |
| vdiv_context | vdiv_init (int16_t pin, float voltage_ref) | 
| void | vdiv_close (vdiv_context dev) | 
| upm_result_t | vdiv_set_scale (const vdiv_context dev, float scale) | 
| upm_result_t | vdiv_set_offset (const vdiv_context dev, float offset) | 
| float | vdiv_get_scale (const vdiv_context dev) | 
| float | vdiv_get_offset (const vdiv_context dev) | 
| upm_result_t | vdiv_set_divsw (const vdiv_context dev, int vdiv_sw) | 
| int | vdiv_get_divsw (const vdiv_context dev) | 
| upm_result_t | vdiv_get_raw_volts (const vdiv_context dev, float *value) | 
| upm_result_t | vdiv_get_computed_volts (const vdiv_context dev, float *value) | 
Typedefs | |
| typedef struct _vdiv_context * | vdiv_context | 
| vdiv_context vdiv_init | ( | int16_t | pin, | 
| float | voltage_ref | ||
| ) | 
Initialize analog sensor
| pin | is Analog pin | 
| void vdiv_close | ( | vdiv_context | dev | ) | 
Analog sensor destructor
| sensor | context pointer deallocate memory | 
| upm_result_t vdiv_set_scale | ( | const vdiv_context | dev, | 
| float | scale | ||
| ) | 
Set sensor scale. This scale is applied to the return value: counts = counts * scale
| dev | sensor context pointer | 
| scale | count scale value used | 
| upm_result_t vdiv_set_offset | ( | const vdiv_context | dev, | 
| float | offset | ||
| ) | 
Set sensor offset. This offset is applied to the return value: counts = counts + offset
| dev | sensor context pointer | 
| offset | count offset value used | 
| float vdiv_get_scale | ( | const vdiv_context | dev | ) | 
Get sensor scale
| dev | sensor context pointer | 
| float vdiv_get_offset | ( | const vdiv_context | dev | ) | 
Get sensor offset
| dev | sensor context pointer | 
| upm_result_t vdiv_set_divsw | ( | const vdiv_context | dev, | 
| int | vdiv_sw | ||
| ) | 
Set sensor divide switch value
| dev | sensor context pointer | 
| vdiv_sw | Divide switch value | 
| int vdiv_get_divsw | ( | const vdiv_context | dev | ) | 
Get divide switch value
| dev | sensor context pointer | 
| upm_result_t vdiv_get_raw_volts | ( | const vdiv_context | dev, | 
| float * | value | ||
| ) | 
Read raw voltage from the sensor
| dev | sensor context pointer | 
| *value | Raw sensor voltage | 
| upm_result_t vdiv_get_computed_volts | ( | const vdiv_context | dev, | 
| float * | value | ||
| ) | 
Gets the true voltage value from the sensor. Voltage divides by 3 or 10, depending on the toggle switch on the board. The dynamic range of the vdiv sensor is listed below.
ADC Ref SW max VOL in
3.3v 3 8.5v 3.3v 10 28.4v 5.0v 3 12.9v 5.0v 10 43.0v
| dev | sensor context pointer | 
| *value | Voltage (v) | 
| typedef struct _vdiv_context * vdiv_context | 
device context
 1.8.6