upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _ecezo_context |
Functions | |
ecezo_context | ecezo_uart_init (unsigned int uart, unsigned int baudrate) |
ecezo_context | ecezo_i2c_init (unsigned int bus, uint8_t addr) |
void | ecezo_close (ecezo_context dev) |
upm_result_t | ecezo_update (const ecezo_context dev) |
upm_result_t | ecezo_set_temperature (const ecezo_context dev, float temp) |
upm_result_t | ecezo_set_k_value (const ecezo_context dev, float k) |
upm_result_t | ecezo_set_sleep (const ecezo_context dev, bool enable) |
float | ecezo_get_ec (const ecezo_context dev) |
float | ecezo_get_tds (const ecezo_context dev) |
float | ecezo_get_salinity (const ecezo_context dev) |
float | ecezo_get_sg (const ecezo_context dev) |
upm_result_t | ecezo_calibrate (const ecezo_context dev, ECEZO_CALIBRATION_T cal, float ec) |
upm_result_t | ecezo_set_continuous (const ecezo_context dev, bool enable) |
int | ecezo_send_command (const ecezo_context dev, char *cmd, char *buffer, int len) |
int | ecezo_read (const ecezo_context dev, char *buffer, size_t len) |
upm_result_t | ecezo_write (const ecezo_context dev, char *buffer, size_t len) |
Typedefs | |
typedef struct _ecezo_context * | ecezo_context |
ecezo_context ecezo_uart_init | ( | unsigned int | uart, |
unsigned int | baudrate | ||
) |
ECEZO Initializer for UART operation
uart | Specify which uart to use. |
baudrate | Specify the baudrate to use. The device defaults to 9600 baud, though the datasheet implies the default is 38400. |
ecezo_context ecezo_i2c_init | ( | unsigned int | bus, |
uint8_t | addr | ||
) |
ECEZO Initializer for I2C operation
bus | Specify which the I2C bus to use. |
addr | Specify the I2C address to use. This is configurable on the device, so there is no default. |
void ecezo_close | ( | ecezo_context | dev | ) |
ECEZO sensor close function
upm_result_t ecezo_update | ( | const ecezo_context | dev | ) |
Query the device for a reading, parse the response, and store the read values into the device context. This function must be called prior to calling any function that returns the data, like ecezo_get_ec().
dev | Device context |
upm_result_t ecezo_set_temperature | ( | const ecezo_context | dev, |
float | temp | ||
) |
For accurate readings, the temperature of the liquid being measured should be known. This function allows you to specify the liquid's temperature (in Celsius) so that proper compensation can take place. How you measure this temperature is up to you. By default, the device will assume a temperature of 25C.
dev | Device context |
temp | The temperature of the liquid being measured |
upm_result_t ecezo_set_k_value | ( | const ecezo_context | dev, |
float | k | ||
) |
Set the K value of the probe being used. By default, this is 1.0. Valid values are between 0.1 and 10.0.
dev | Device context |
k | The K value of the probe |
upm_result_t ecezo_set_sleep | ( | const ecezo_context | dev, |
bool | enable | ||
) |
Enable or disable Sleep mode.
dev | Device context |
enable | True to enable sleep mode, false to wake up |
float ecezo_get_ec | ( | const ecezo_context | dev | ) |
Retrieve the last measured Electrical Conductivity (EC) value in microsiemens. ecezo_update() must have been called before calling this function.
dev | Device context |
float ecezo_get_tds | ( | const ecezo_context | dev | ) |
Retrieve the last measured Total Dissolved solids (TDS) value. ecezo_update() must have been called before calling this function.
dev | Device context |
float ecezo_get_salinity | ( | const ecezo_context | dev | ) |
Retrieve the last measured Salinity value. ecezo_update() must have been called before calling this function.
dev | Device context |
float ecezo_get_sg | ( | const ecezo_context | dev | ) |
Retrieve the last measured Specific Gravity (SG) value. ecezo_update() must have been called before calling this function.
dev | Device context |
upm_result_t ecezo_calibrate | ( | const ecezo_context | dev, |
ECEZO_CALIBRATION_T | cal, | ||
float | ec | ||
) |
Specify calibration data for calibrating the device. See the datasheet for details on how calibration is performed. This function provides a mechanism for clearing out, and setting calibration data.
A simple one point calibration might work as follows:
A two point calibration might work as follows:
dev | Device context |
cal | One of the ECEZO_CALIBRATION_T values |
ec | The EC value of the calibration fluid. This parameter is ignored when cal is either ECEZO_CALIBRATE_CLEAR or ECEZO_CALIBRATE_DRY. |
upm_result_t ecezo_set_continuous | ( | const ecezo_context | dev, |
bool | enable | ||
) |
Enable or disable "continuous" operation. In continuous operation, the device will sample and emit readings every second. The driver disables this mode by default. If you wish to use continuous mode, you will be responsible for reading and parsing the returned data yourself.
The functionality of this driver depends on continuous mode being disabled. When disabled, the driver will manually request a reading when desired via ecezo_update().
dev | Device context |
enable | true to enable continuous mode, false to disable. |
int ecezo_send_command | ( | const ecezo_context | dev, |
char * | cmd, | ||
char * | buffer, | ||
int | len | ||
) |
Directly send a command to the device and optionally get a response. This is a low level function and should not be called unless you know what you are doing.
dev | Device context |
cmd | command to send to the device. See the datasheet for valid commands. |
buffer | Optional buffer in which to return any data. NULL if you are not interested in any returned data. |
len | Length of the buffer, or 0 if you are not interested in returned data |
int ecezo_read | ( | const ecezo_context | dev, |
char * | buffer, | ||
size_t | len | ||
) |
Read character data from the device. This is a low level function and should not be called unless you know what you are doing.
dev | sensor context |
buffer | The character buffer to read data into. |
len | The maximum size of the buffer |
upm_result_t ecezo_write | ( | const ecezo_context | dev, |
char * | buffer, | ||
size_t | len | ||
) |
Write character data to the device. This is a low level function and should not be called unless you know what you are doing.
dev | sensor context |
buffer | The character buffer containing data to write. |
len | The number of bytes to write. |
typedef struct _ecezo_context * ecezo_context |
Device context