HS3xxx Temperature/Humidity Sensor API.
More...
|
| file | hs3xxx.h |
| | HS3xxx sensor declarations.
|
| |
HS3xxx Temperature/Humidity Sensor API.
HS3xxx is a series of highly-accurate, fully-calibrated relative humidity and temperature sensors.
The HS3xxx API provides convenient access to the temperature & humidity measurement capabilities of the sensor.
◆ HTError_t
Error code definitions specific for the HS3xxx API.
| Enumerator |
|---|
| hteStaleData | Sensor reported stale data.
|
◆ HS3xxx_Init()
Initialize the sensor object.
This function tries accessing the HS3xxx I2C address using hal as hardware interface. On success, the sensor object is initialized and can be used afterwards. Otherwise, an error code is returned and the sensor object is not usable.
- Note
- The HS3xxx API requires that the HAL interface object has the Interface_t::i2cRead and Interface_t::i2cWrite members defined. In addition, HS3xxx_Measure() requires the Interface_t::msSleep member, however, the check for this function is done in HS3xxx_Measure() and not in HS3xxx_Init().
- Parameters
-
| sensor | Pointer to sensor object to be initialized |
| hal | Pointer to HAL object providing physical communication |
- Returns
- int Error code
- Return values
-
| 0 | On success |
| other | On error |
◆ HS3xxx_Measure()
Execute a temperature/humidity measurement cycle.
This function starts a measurement cycle in non-hold mode, waits for the result to be available and reads it. This is a convenience function which calls HS3xxx_MeasureStart() and HS3xxx_MeasureRead() with a delay between both calls, to allow the sensor to complete its measurement.
- Parameters
-
| sensor | Pointer to an initialized sensor object |
| results | Pointer to a data structure, to store results in |
- Returns
- int Error code
- Return values
-
| 0 | On success |
| other | On error |
◆ HS3xxx_MeasureRead()
Read temperature/humidity results.
This function reads the temperature/humidity results from a measurement that has been started through HS3xxx_MeasureStart() previously.
- Parameters
-
| sensor | Pointer to an initialized sensor object |
| results | Pointer to a data structure, to store results in |
- Returns
- int Error code
- Return values
-
| 0 | On success |
| other | On error |
◆ HS3xxx_MeasureStart()
| int HS3xxx_MeasureStart |
( |
HSxxxx_t * |
sensor | ) |
|
Start a temperature/humidity measurement cycle.
- Parameters
-
| sensor | Pointer to an initialized sensor object |
- Returns
- int Error code
- Return values
-
| 0 | On success |
| other | On error |
◆ HS3xxx_ReadID()
| int HS3xxx_ReadID |
( |
HSxxxx_t * |
sensor, |
|
|
uint32_t * |
id |
|
) |
| |
Read the unique sensor ID of the HS3xxx.
- Parameters
-
| sensor | Pointer to an initialized sensor object |
| id | Pointer buffer to store the ID |
- Returns
- int Error code
- Return values
-
| 0 | On success |
| other | On error |