upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _dfrec_context |
Functions | |
dfrec_context | dfrec_init (unsigned int apin, unsigned int uart_ow, unsigned int device_idx, float a_ref) |
void | dfrec_close (dfrec_context dev) |
upm_result_t | dfrec_update (const dfrec_context dev) |
void | dfrec_set_offset (const dfrec_context dev, float offset) |
void | dfrec_set_scale (const dfrec_context dev, float scale) |
float | dfrec_get_ec (const dfrec_context dev) |
float | dfrec_get_volts (const dfrec_context dev) |
float | dfrec_get_temperature (const dfrec_context dev) |
float | dfrec_get_normalized (const dfrec_context dev) |
void | dfrec_set_threshold_min_max (const dfrec_context dev, float min, float max) |
void | dfrec_set_threshold_1 (const dfrec_context dev, float thres, float scale, float offset) |
void | dfrec_set_threshold_2 (const dfrec_context dev, float thres, float scale, float offset) |
void | dfrec_set_threshold_3 (const dfrec_context dev, float scale, float offset) |
Typedefs | |
typedef struct _dfrec_context * | dfrec_context |
dfrec_context dfrec_init | ( | unsigned int | apin, |
unsigned int | uart_ow, | ||
unsigned int | device_idx, | ||
float | a_ref | ||
) |
DFREC Initializer
apin | Analog pin to use. |
uart_ow | The UART that the ds10b20 temperature sensor is connected to. |
device_idx | The device index of the ds18b20 sensor to use. If you only have 1 ds18b20 sensor on your DS one wire bus, you would pass 0 here. |
a_ref | The analog reference voltage in use |
void dfrec_close | ( | dfrec_context | dev | ) |
DFREC sensor close function
upm_result_t dfrec_update | ( | const dfrec_context | dev | ) |
Read the sensor status and update internal state. dfrec_update() must have been called before calling any of the other dfrec_get*() functions
dev | sensor context |
void dfrec_set_offset | ( | const dfrec_context | dev, |
float | offset | ||
) |
Set sensor offset. This offset is applied to the EC value before scaling. Default is 0.0.
dev | sensor context pointer |
offset | Offset to apply to the computed EC value |
void dfrec_set_scale | ( | const dfrec_context | dev, |
float | scale | ||
) |
Set sensor scale. The EC return value is scaled by this value before the offset is applied. Default is 1.0.
dev | sensor context pointer |
scale | The scale to apply to the computed EC value |
float dfrec_get_ec | ( | const dfrec_context | dev | ) |
Get computed EC (in ms/cm) value from the sensor. dfrec_update() must have been called prior to calling this function.
dev | sensor context pointer |
float dfrec_get_volts | ( | const dfrec_context | dev | ) |
Get the raw measured volts from the sensor. dfrec_update() must have been called prior to calling this function.
dev | sensor context pointer |
float dfrec_get_temperature | ( | const dfrec_context | dev | ) |
Get the measured temperature from the temperature sensor. The return value will be in Celsius.
dev | sensor context pointer |
float dfrec_get_normalized | ( | const dfrec_context | dev | ) |
Get the raw normalized ADC values from the sensor. dfrec_update() must have been called prior to calling this function.
dev | sensor context pointer |
void dfrec_set_threshold_min_max | ( | const dfrec_context | dev, |
float | min, | ||
float | max | ||
) |
Set the global threshold min and max values. See the DFRobot wiki for details.
dev | sensor context pointer |
min | Minimum threshold to be valid. Default 150. |
max | Maximum threshold to be valid. Default 3300. |
void dfrec_set_threshold_1 | ( | const dfrec_context | dev, |
float | thres, | ||
float | scale, | ||
float | offset | ||
) |
Set the threshold 1 values. See the DFRobot wiki for details.
dev | sensor context pointer |
thres | Threshold maximum for value section 1. Default 448. |
scale | Scale for value section 1. Default 6.64. |
offset | Offset for value section 1. Default -64.32. |
void dfrec_set_threshold_2 | ( | const dfrec_context | dev, |
float | thres, | ||
float | scale, | ||
float | offset | ||
) |
Set the threshold 2 values. See the DFRobot wiki for details.
dev | sensor context pointer |
thres | Threshold maximum for value section 2. Default 1457. |
scale | Scale for value section 2. Default 6.98. |
offset | Offset for value section 2. Default -127.0. |
void dfrec_set_threshold_3 | ( | const dfrec_context | dev, |
float | scale, | ||
float | offset | ||
) |
Set the threshold 3 values. See the DFRobot wiki for details.
dev | sensor context pointer |
scale | Scale for value section 3. Default 5.3. |
offset | Offset for value section 3. Default 2278. |
typedef struct _dfrec_context * dfrec_context |
Device context