| 
    Firmware SDK
    
   | 
 
Driver for soil sensor. More...
Data Structures | |
| struct | twr_soil_sensor_eeprom_header_t | 
| struct | twr_soil_sensor_eeprom_t | 
Typedefs | |
| typedef struct twr_soil_sensor_t | twr_soil_sensor_t | 
| Soil sensor instance.  | |
| typedef struct twr_soil_sensor_sensor_t | twr_soil_sensor_sensor_t | 
Enumerations | |
| enum | twr_soil_sensor_event_t {  TWR_SOIL_SENSOR_EVENT_ERROR = 0 , TWR_SOIL_SENSOR_EVENT_UPDATE = 1 }  | 
| Callback events.  More... | |
| enum | twr_soil_sensor_error_t {  TWR_SOIL_SENSOR_ERROR_NONE = 0 , TWR_SOIL_SENSOR_ERROR_SENSOR_MODULE_INITIALIZE = 1 , TWR_SOIL_SENSOR_ERROR_SENSOR_MODULE_POWER_UP = 2 , TWR_SOIL_SENSOR_ERROR_NO_SENSOR_FOUND = 3 , TWR_SOIL_SENSOR_ERROR_TMP112_INITIALIZE = 4 , TWR_SOIL_SENSOR_ERROR_EEPROM_HEADER_READ = 5 , TWR_SOIL_SENSOR_ERROR_EEPROM_SIGNATURE = 6 , TWR_SOIL_SENSOR_ERROR_EEPROM_VERSION = 7 , TWR_SOIL_SENSOR_ERROR_EEPROM_PAYLOAD_LENGTH = 8 , TWR_SOIL_SENSOR_ERROR_EEPROM_PAYLOAD_READ = 9 , TWR_SOIL_SENSOR_ERROR_EEPROM_PAYLOAD_CRC = 10 , TWR_SOIL_SENSOR_ERROR_ZSSC3123_INITIALIZE = 11 , TWR_SOIL_SENSOR_ERROR_TMP112_MEASUREMENT_REQUEST = 12 , TWR_SOIL_SENSOR_ERROR_ZSSC3123_MEASUREMENT_REQUEST = 13 , TWR_SOIL_SENSOR_ERROR_TMP112_DATA_FETCH = 14 , TWR_SOIL_SENSOR_ERROR_ZSSC3123_DATA_FETCH = 15 }  | 
| Error numbers.  More... | |
Functions | |
| void | twr_soil_sensor_init (twr_soil_sensor_t *self) | 
| Initialize Soil sensor.  More... | |
| void | twr_soil_sensor_init_multiple (twr_soil_sensor_t *self, twr_soil_sensor_sensor_t *sensors, int sensor_count) | 
| Initialize multiple Soil sensor.  More... | |
| void | twr_soil_sensor_set_event_handler (twr_soil_sensor_t *self, void(*event_handler)(twr_soil_sensor_t *, uint64_t, twr_soil_sensor_event_t, void *), void *event_param) | 
| Set callback function.  More... | |
| void | twr_soil_sensor_set_update_interval (twr_soil_sensor_t *self, twr_tick_t interval) | 
| Set measurement interval.  More... | |
| int | twr_soil_sensor_get_sensor_found (twr_soil_sensor_t *self) | 
| Get sensors found.  More... | |
| bool | twr_soil_sensor_measure (twr_soil_sensor_t *self) | 
| Start measurement manually.  More... | |
| bool | twr_soil_sensor_get_temperature_raw (twr_soil_sensor_t *self, uint64_t device_address, int16_t *raw) | 
| Get measured temperature as raw value.  More... | |
| bool | twr_soil_sensor_get_temperature_celsius (twr_soil_sensor_t *self, uint64_t device_address, float *celsius) | 
| Get measured temperature in degrees of Celsius.  More... | |
| bool | twr_soil_sensor_get_temperature_fahrenheit (twr_soil_sensor_t *self, uint64_t device_address, float *fahrenheit) | 
| Get measured temperature in degrees of Fahrenheit.  More... | |
| bool | twr_soil_sensor_get_temperature_kelvin (twr_soil_sensor_t *self, uint64_t device_address, float *kelvin) | 
| Get measured temperature in kelvin.  More... | |
| bool | twr_soil_sensor_get_cap_raw (twr_soil_sensor_t *self, uint64_t device_address, uint16_t *raw) | 
| Get capacite as raw value.  More... | |
| bool | twr_soil_sensor_get_moisture (twr_soil_sensor_t *self, uint64_t device_address, int *moisture) | 
| Get measured moisture in percent.  More... | |
| int | twr_soil_sensor_get_index_by_device_address (twr_soil_sensor_t *self, uint64_t device_address) | 
| Get device index by its device address.  More... | |
| uint64_t | twr_soil_sensor_get_device_address_by_index (twr_soil_sensor_t *self, int index) | 
| Get device device address by its index.  More... | |
| char * | twr_soil_sensor_get_label (twr_soil_sensor_t *self, uint64_t device_address) | 
| Get device label by its device address.  More... | |
| bool | twr_soil_sensor_set_label (twr_soil_sensor_t *self, uint64_t device_address, const char *label) | 
| Get device label by its device address.  More... | |
| bool | twr_soil_sensor_calibration_set_point (twr_soil_sensor_t *self, uint64_t device_address, uint8_t point, uint16_t value) | 
| Set value for calibration point by device address.  More... | |
| bool | twr_soil_sensor_eeprom_save (twr_soil_sensor_t *self, uint64_t device_address) | 
| Save calibration points and label to eeprom by device address.  More... | |
| twr_soil_sensor_error_t | twr_soil_sensor_get_error (twr_soil_sensor_t *self) | 
| Get error number.  More... | |
Driver for soil sensor.
Error numbers.
Definition at line 26 of file twr_soil_sensor.h.
Callback events.
| Enumerator | |
|---|---|
| TWR_SOIL_SENSOR_EVENT_ERROR | Error event.  | 
| TWR_SOIL_SENSOR_EVENT_UPDATE | Update event.  | 
Definition at line 14 of file twr_soil_sensor.h.
| bool twr_soil_sensor_calibration_set_point | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| uint8_t | point, | ||
| uint16_t | value | ||
| ) | 
Set value for calibration point by device address.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [in] | point | 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 | 
| [in] | value | 
Definition at line 267 of file twr_soil_sensor.c.

| bool twr_soil_sensor_eeprom_save | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address | ||
| ) | 
Save calibration points and label to eeprom by device address.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
Definition at line 288 of file twr_soil_sensor.c.

| bool twr_soil_sensor_get_cap_raw | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| uint16_t * | raw | ||
| ) | 
Get capacite as raw value.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [out] | raw | Pointer to variable where result will be stored | 
Definition at line 160 of file twr_soil_sensor.c.

| uint64_t twr_soil_sensor_get_device_address_by_index | ( | twr_soil_sensor_t * | self, | 
| int | index | ||
| ) | 
Get device device address by its index.
| [in] | self | Instance | 
| [in] | index | Index | 
Definition at line 231 of file twr_soil_sensor.c.
| twr_soil_sensor_error_t twr_soil_sensor_get_error | ( | twr_soil_sensor_t * | self | ) | 
| int twr_soil_sensor_get_index_by_device_address | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address | ||
| ) | 
Get device index by its device address.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
Definition at line 218 of file twr_soil_sensor.c.
Referenced by twr_soil_sensor_calibration_set_point(), twr_soil_sensor_eeprom_save(), twr_soil_sensor_get_cap_raw(), twr_soil_sensor_get_label(), twr_soil_sensor_get_moisture(), twr_soil_sensor_get_temperature_raw(), and twr_soil_sensor_set_label().

| char* twr_soil_sensor_get_label | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address | ||
| ) | 
Get device label by its device address.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
Definition at line 241 of file twr_soil_sensor.c.

| bool twr_soil_sensor_get_moisture | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| int * | moisture | ||
| ) | 
Get measured moisture in percent.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [in] | moisture | Pointer to variable where result will be stored | 
Definition at line 179 of file twr_soil_sensor.c.

| int twr_soil_sensor_get_sensor_found | ( | twr_soil_sensor_t * | self | ) | 
Get sensors found.
| [in] | self | Instance | 
Definition at line 73 of file twr_soil_sensor.c.
| bool twr_soil_sensor_get_temperature_celsius | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| float * | celsius | ||
| ) | 
Get measured temperature in degrees of Celsius.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [in] | celsius | Pointer to variable where result will be stored | 
Definition at line 111 of file twr_soil_sensor.c.
Referenced by twr_soil_sensor_get_temperature_fahrenheit(), and twr_soil_sensor_get_temperature_kelvin().


| bool twr_soil_sensor_get_temperature_fahrenheit | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| float * | fahrenheit | ||
| ) | 
Get measured temperature in degrees of Fahrenheit.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [in] | fahrenheit | Pointer to variable where result will be stored | 
Definition at line 127 of file twr_soil_sensor.c.

| bool twr_soil_sensor_get_temperature_kelvin | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| float * | kelvin | ||
| ) | 
Get measured temperature in kelvin.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [in] | kelvin | Pointer to variable where result will be stored | 
Definition at line 141 of file twr_soil_sensor.c.

| bool twr_soil_sensor_get_temperature_raw | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| int16_t * | raw | ||
| ) | 
Get measured temperature as raw value.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [out] | raw | Pointer to variable where result will be stored | 
Definition at line 92 of file twr_soil_sensor.c.
Referenced by twr_soil_sensor_get_temperature_celsius().


| void twr_soil_sensor_init | ( | twr_soil_sensor_t * | self | ) | 
Initialize Soil sensor.
| [in] | self | Instance | 
Definition at line 29 of file twr_soil_sensor.c.

| void twr_soil_sensor_init_multiple | ( | twr_soil_sensor_t * | self, | 
| twr_soil_sensor_sensor_t * | sensors, | ||
| int | sensor_count | ||
| ) | 
Initialize multiple Soil sensor.
| [in] | self | Instance | 
| [in] | sensors | Sensors array | 
| [in] | sensor_count | Sensors count | 
Definition at line 36 of file twr_soil_sensor.c.
Referenced by twr_soil_sensor_init().


| bool twr_soil_sensor_measure | ( | twr_soil_sensor_t * | self | ) | 
Start measurement manually.
| [in] | self | Instance | 
Definition at line 78 of file twr_soil_sensor.c.
Referenced by twr_soil_sensor_set_update_interval().


| void twr_soil_sensor_set_event_handler | ( | twr_soil_sensor_t * | self, | 
| void(*)(twr_soil_sensor_t *, uint64_t, twr_soil_sensor_event_t, void *) | event_handler, | ||
| void * | event_param | ||
| ) | 
Set callback function.
| [in] | self | Instance | 
| [in] | event_handler | Function address | 
| [in] | event_param | Optional event parameter (can be NULL) | 
| bool twr_soil_sensor_set_label | ( | twr_soil_sensor_t * | self, | 
| uint64_t | device_address, | ||
| const char * | label | ||
| ) | 
Get device label by its device address.
| [in] | self | Instance | 
| [in] | device_address | 64b device address | 
| [in] | label | New label | 
Definition at line 253 of file twr_soil_sensor.c.

| void twr_soil_sensor_set_update_interval | ( | twr_soil_sensor_t * | self, | 
| twr_tick_t | interval | ||
| ) | 
Set measurement interval.
| [in] | self | Instance | 
| [in] | interval | Measurement interval | 
Definition at line 57 of file twr_soil_sensor.c.
