ruuvi.drivers.c
${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
Implement rd_sensor_t functions on SHTCX. More...
Macros | |
#define | LOW_POWER_SLEEP_MS_MIN (1000U) |
#define | SHTCX_PROBE_RETRIES_MAX (5U) |
#define | RETURN_SUCCESS_ON_VALID(param) |
Macro for checking "ignored" parameters NO_CHANGE, MIN, MAX, DEFAULT. More... | |
#define | VERIFY_SENSOR_SLEEPS() |
Macro for checking that sensor is in sleep mode before configuration. More... | |
#define | STATUS_OK 0 |
SHTC driver ok. More... | |
#define | STATUS_ERR_BAD_DATA (-1) |
SHTC driver data invald. More... | |
#define | STATUS_CRC_FAIL (-2) |
SHTC driver CRC error. More... | |
#define | STATUS_UNKNOWN_DEVICE (-3) |
Invalid WHOAMI. More... | |
#define | STATUS_WAKEUP_FAILED (-4) |
Device didn't wake up. More... | |
#define | STATUS_SLEEP_FAILED (-5) |
Device didn't go to sleep. More... | |
Implement rd_sensor_t functions on SHTCX.
The implementation supports taking single-samples and a pseudo-continuous mode by taking a new sample when data is polled in continuous mode
#define LOW_POWER_SLEEP_MS_MIN (1000U) |
Definition at line 32 of file ruuvi_interface_shtcx.c.
#define RETURN_SUCCESS_ON_VALID | ( | param | ) |
Macro for checking "ignored" parameters NO_CHANGE, MIN, MAX, DEFAULT.
Definition at line 41 of file ruuvi_interface_shtcx.c.
#define SHTCX_PROBE_RETRIES_MAX (5U) |
Definition at line 33 of file ruuvi_interface_shtcx.c.
#define STATUS_CRC_FAIL (-2) |
SHTC driver CRC error.
Definition at line 65 of file ruuvi_interface_shtcx.c.
#define STATUS_ERR_BAD_DATA (-1) |
SHTC driver data invald.
Definition at line 64 of file ruuvi_interface_shtcx.c.
#define STATUS_OK 0 |
SHTC driver ok.
Definition at line 63 of file ruuvi_interface_shtcx.c.
#define STATUS_SLEEP_FAILED (-5) |
Device didn't go to sleep.
Definition at line 68 of file ruuvi_interface_shtcx.c.
#define STATUS_UNKNOWN_DEVICE (-3) |
Invalid WHOAMI.
Definition at line 66 of file ruuvi_interface_shtcx.c.
#define STATUS_WAKEUP_FAILED (-4) |
Device didn't wake up.
Definition at line 67 of file ruuvi_interface_shtcx.c.
#define VERIFY_SENSOR_SLEEPS | ( | ) |
Macro for checking that sensor is in sleep mode before configuration.
Definition at line 50 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_data_get | ( | rd_sensor_data_t *const | p_data | ) |
Definition at line 337 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_dsp_get | ( | uint8_t * | dsp, |
uint8_t * | parameter | ||
) |
Definition at line 258 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_dsp_set | ( | uint8_t * | dsp, |
uint8_t * | parameter | ||
) |
Definition at line 240 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_init | ( | rd_sensor_t * | sensor, |
rd_bus_t | bus, | ||
uint8_t | handle | ||
) |
Definition at line 91 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_mode_get | ( | uint8_t * | mode | ) |
Definition at line 320 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_mode_set | ( | uint8_t * | mode | ) |
Definition at line 269 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_resolution_get | ( | uint8_t * | resolution | ) |
Definition at line 213 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_resolution_set | ( | uint8_t * | resolution | ) |
Definition at line 202 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_samplerate_get | ( | uint8_t * | samplerate | ) |
Definition at line 194 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_samplerate_set | ( | uint8_t * | samplerate | ) |
Definition at line 178 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_scale_get | ( | uint8_t * | scale | ) |
Definition at line 232 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_scale_set | ( | uint8_t * | scale | ) |
Definition at line 221 of file ruuvi_interface_shtcx.c.
rd_status_t ri_shtcx_uninit | ( | rd_sensor_t * | sensor, |
rd_bus_t | bus, | ||
uint8_t | handle | ||
) |
Definition at line 161 of file ruuvi_interface_shtcx.c.
void sensirion_sleep_usec | ( | uint32_t | useconds | ) |
Implement sleep function for SHTC driver.
Sleep for a given number of microseconds. The function should delay the execution for at least the given time, but may also sleep longer.
If delay is at least millisecond, The function sleeps given number of milliseconds, rounded up, to benefit from low-power sleep in millisecond delay.
[in] | useconds | the sleep time in microseconds |
Definition at line 395 of file ruuvi_interface_shtcx.c.