Contiki-NG
|
Humidity Sensor. More...
Files | |
file | hdc-1000-sensor.c |
Driver for the Sensortag HDC1000 sensor. | |
file | hdc-1000-sensor.h |
Header file for the Sensortag HDC1000 sensor. | |
Functions | |
static bool | sensor_init (void) |
Initialize the HDC-1000 sensor driver. More... | |
static bool | start (void) |
Start measurement. More... | |
static void | convert (int32_t *temp, int32_t *hum) |
Convert raw data to temperature and humidity. More... | |
static void | notify_ready (void *unused) |
Callback when sensor is ready to read data from. | |
static int | value (int type) |
Returns a reading from the sensor. More... | |
static int | configure (int type, int enable) |
Configuration function for the HDC1000 sensor. More... | |
static int | status (int type) |
Returns the status of the sensor. More... | |
Humidity Sensor.
Due to the time required for the sensor to startup, this driver is meant to be used in an asynchronous fashion. The caller must first activate the sensor by calling SENSORS_ACTIVATE(). This will trigger the sensor's startup sequence, but the call will not wait for it to complete so that the CPU can perform other tasks or drop to a low power mode. Once the sensor has taken readings, it will automatically go back to low power mode.
Once the sensor is stable, the driver will retrieve readings from the sensor and latch them. It will then generate a sensors_changed event.
The user can then retrieve readings by calling .value() and by passing either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID as the argument. Multiple calls to value() will not trigger new readings, they will simply return the most recent latched values.
The user can query the sensor's status by calling status().
To get a fresh reading, the user must trigger a new reading cycle by calling SENSORS_ACTIVATE().
Definition at line 87 of file hdc-1000-sensor.h.
|
static |
Configuration function for the HDC1000 sensor.
type | Activate, enable or disable the sensor. See below. |
enable | Either enable or disable the sensor. When type == SENSORS_HW_INIT we turn on the hardware. When type == SENSORS_ACTIVE and enable==1 we enable the sensor. When type == SENSORS_ACTIVE and enable==0 we disable the sensor. |
Definition at line 302 of file hdc-1000-sensor.c.
|
static |
Convert raw data to temperature and humidity.
temp | Output variable to store converted temperature. |
hum | Output variable to store converted humidity. |
Definition at line 207 of file hdc-1000-sensor.c.
|
static |
Initialize the HDC-1000 sensor driver.
Definition at line 147 of file hdc-1000-sensor.c.
|
static |
Start measurement.
Definition at line 178 of file hdc-1000-sensor.c.
|
static |
Returns the status of the sensor.
type | SENSORS_ACTIVE or SENSORS_READY. |
Definition at line 346 of file hdc-1000-sensor.c.
|
static |
Returns a reading from the sensor.
type | HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID. |
Definition at line 263 of file hdc-1000-sensor.c.