|
ChibiOS
19.1.4
|
|
Macros | |
| #define | hts221HygrometerGetAxesNumber(devp) hygrometerGetAxesNumber(&((devp)->hygro_if)) |
| Return the number of axes of the BaseHygrometer. More... | |
| #define | hts221HygrometerReadRaw(devp, axes) hygrometerReadRaw(&((devp)->hygro_if), axes) |
| Retrieves raw data from the BaseHygrometer. More... | |
| #define | hts221HygrometerReadCooked(devp, axes) hygrometerReadCooked(&((devp)->hygro_if), axes) |
| Retrieves cooked data from the BaseHygrometer. More... | |
| #define | hts221HygrometerSetBias(devp, bp) hygrometerSetBias(&((devp)->hygro_if), bp) |
| Set bias values for the BaseHygrometer. More... | |
| #define | hts221HygrometerResetBias(devp) hygrometerResetBias(&((devp)->hygro_if)) |
| Reset bias values for the BaseHygrometer. More... | |
| #define | hts221HygrometerSetSensitivity(devp, sp) hygrometerSetSensitivity(&((devp)->hygro_if), sp) |
| Set sensitivity values for the BaseHygrometer. More... | |
| #define | hts221HygrometerResetSensitivity(devp) hygrometerResetSensitivity(&((devp)->hygro_if)) |
| Reset sensitivity values for the BaseHygrometer. More... | |
| #define | hts221ThermometerGetAxesNumber(devp) thermometerGetAxesNumber(&((devp)->thermo_if)) |
| Return the number of axes of the BaseThermometer. More... | |
| #define | hts221ThermometerReadRaw(devp, axes) thermometerReadRaw(&((devp)->thermo_if), axes) |
| Retrieves raw data from the BaseThermometer. More... | |
| #define | hts221ThermometerReadCooked(devp, axes) thermometerReadCooked(&((devp)->thermo_if), axes) |
| Retrieves cooked data from the BaseThermometer. More... | |
| #define | hts221ThermometerSetBias(devp, bp) thermometerSetBias(&((devp)->thermo_if), bp) |
| Set bias values for the BaseThermometer. More... | |
| #define | hts221ThermometerResetBias(devp) thermometerResetBias(&((devp)->thermo_if)) |
| Reset bias values for the BaseThermometer. More... | |
| #define | hts221ThermometerSetSensitivity(devp, sp) thermometerSetSensitivity(&((devp)->thermo_if), sp) |
| Set sensitivity values for the BaseThermometer. More... | |
| #define | hts221ThermometerResetSensitivity(devp) thermometerResetSensitivity(&((devp)->thermo_if)) |
| Reset sensitivity values for the BaseThermometer. More... | |
Version identification | |
| #define | EX_HTS221_VERSION "1.1.2" |
| HTS221 driver version string. More... | |
| #define | EX_HTS221_MAJOR 1 |
| HTS221 driver version major number. More... | |
| #define | EX_HTS221_MINOR 1 |
| HTS221 driver version minor number. More... | |
| #define | EX_HTS221_PATCH 2 |
| HTS221 driver version patch number. More... | |
| #define | HTS221_HYGRO_NUMBER_OF_AXES 1U |
| HTS221 hygrometer subsystem characteristics. More... | |
| #define | HTS221_THERMO_NUMBER_OF_AXES 1U |
| HTS221 thermometer subsystem characteristics. More... | |
HTS221_CTRL_REG3 register bits definitions | |
| #define | HTS221_CTRL_REG3_MASK 0xC4 |
| #define | HTS221_CTRL_REG3_DRDY (1 << 2) |
| #define | HTS221_CTRL_REG3_PP_OD (1 << 6) |
| #define | HTS221_CTRL_REG3_INT_H_L (1 << 7) |
Configuration options | |
| #define | HTS221_USE_SPI FALSE |
| HTS221 SPI interface switch. More... | |
| #define | HTS221_SHARED_SPI FALSE |
| HTS221 shared SPI switch. More... | |
| #define | HTS221_USE_I2C TRUE |
| HTS221 I2C interface switch. More... | |
| #define | HTS221_SHARED_I2C FALSE |
| HTS221 shared I2C switch. More... | |
| #define | HTS221_USE_ADVANCED FALSE |
| HTS221 advanced configurations switch. More... | |
HTS221 data structures and types. | |
| |
| typedef struct HTS221Driver | HTS221Driver |
| Structure representing a HTS221 driver. More... | |
| #define | _hts221_methods_alone |
HTS221 specific methods. More... | |
| #define | _hts221_methods |
HTS221 specific methods with inherited ones. More... | |
| #define | _hts221_data |
HTS221Driver specific data. More... | |
Data Structures | |
| struct | HTS221Config |
| HTS221 configuration structure. More... | |
| struct | HTS221VMT |
HTS221 virtual methods table. More... | |
| struct | HTS221Driver |
| HTS221 2-axis hygrometer/thermometer class. More... | |
Functions | |
| static msg_t | hts221I2CReadRegister (I2CDriver *i2cp, uint8_t reg, uint8_t *rxbuf, size_t n) |
| Reads registers value using I2C. More... | |
| static msg_t | hts221I2CWriteRegister (I2CDriver *i2cp, uint8_t *txbuf, size_t n) |
| Writes a value into a register using I2C. More... | |
| static msg_t | hts221Calibrate (HTS221Driver *devp) |
| Computes biases and sensitivities starting from data stored in calibration registers. More... | |
| static size_t | hygro_get_axes_number (void *ip) |
| Return the number of axes of the BaseHygrometer. More... | |
| static msg_t | hygro_read_raw (void *ip, int32_t axes[]) |
| Retrieves raw data from the BaseHygrometer. More... | |
| static msg_t | hygro_read_cooked (void *ip, float axes[]) |
| Retrieves cooked data from the BaseHygrometer. More... | |
| static msg_t | hygro_set_bias (void *ip, float *bp) |
| Set bias values for the BaseHygrometer. More... | |
| static msg_t | hygro_reset_bias (void *ip) |
| Reset bias values for the BaseHygrometer. More... | |
| static msg_t | hygro_set_sensitivity (void *ip, float *sp) |
| Set sensitivity values for the BaseHygrometer. More... | |
| static msg_t | hygro_reset_sensitivity (void *ip) |
| Reset sensitivity values for the BaseHygrometer. More... | |
| static size_t | thermo_get_axes_number (void *ip) |
| Return the number of axes of the BaseThermometer. More... | |
| static msg_t | thermo_read_raw (void *ip, int32_t axes[]) |
| Retrieves raw data from the BaseThermometer. More... | |
| static msg_t | thermo_read_cooked (void *ip, float *axis) |
| Retrieves cooked data from the BaseThermometer. More... | |
| static msg_t | thermo_set_bias (void *ip, float *bp) |
| Set bias values for the BaseThermometer. More... | |
| static msg_t | thermo_reset_bias (void *ip) |
| Reset bias values for the BaseThermometer. More... | |
| static msg_t | thermo_set_sensitivity (void *ip, float *sp) |
| Set sensitivity values for the BaseThermometer. More... | |
| static msg_t | thermo_reset_sensitivity (void *ip) |
| Reset sensitivity values for the BaseThermometer. More... | |
| void | hts221ObjectInit (HTS221Driver *devp) |
| Initializes an instance. More... | |
| void | hts221Start (HTS221Driver *devp, const HTS221Config *config) |
| Configures and activates HTS221 Complex Driver peripheral. More... | |
| void | hts221Stop (HTS221Driver *devp) |
| Deactivates the HTS221 Complex Driver peripheral. More... | |
| #define EX_HTS221_VERSION "1.1.2" |
| #define EX_HTS221_MAJOR 1 |
| #define EX_HTS221_MINOR 1 |
| #define EX_HTS221_PATCH 2 |
| #define HTS221_HYGRO_NUMBER_OF_AXES 1U |
HTS221 hygrometer subsystem characteristics.
Definition at line 72 of file hts221.h.
Referenced by hts221ObjectInit(), and hygro_get_axes_number().
| #define HTS221_THERMO_NUMBER_OF_AXES 1U |
HTS221 thermometer subsystem characteristics.
Definition at line 85 of file hts221.h.
Referenced by hts221ObjectInit(), and thermo_get_axes_number().
| #define HTS221_USE_SPI FALSE |
| #define HTS221_SHARED_SPI FALSE |
| #define HTS221_USE_I2C TRUE |
| #define HTS221_SHARED_I2C FALSE |
| #define HTS221_USE_ADVANCED FALSE |
| #define _hts221_methods_alone |
| #define _hts221_methods |
HTS221 specific methods with inherited ones.
| #define _hts221_data |
HTS221Driver specific data.
| #define hts221HygrometerGetAxesNumber | ( | devp | ) | hygrometerGetAxesNumber(&((devp)->hygro_if)) |
Return the number of axes of the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| #define hts221HygrometerReadRaw | ( | devp, | |
| axes | |||
| ) | hygrometerReadRaw(&((devp)->hygro_if), axes) |
Retrieves raw data from the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| [out] | axes | a buffer which would be filled with raw data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
| #define hts221HygrometerReadCooked | ( | devp, | |
| axes | |||
| ) | hygrometerReadCooked(&((devp)->hygro_if), axes) |
Retrieves cooked data from the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| [out] | axes | a buffer which would be filled with cooked data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
| #define hts221HygrometerSetBias | ( | devp, | |
| bp | |||
| ) | hygrometerSetBias(&((devp)->hygro_if), bp) |
Set bias values for the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| [in] | bp | a buffer which contains biases. |
| MSG_OK | if the function succeeded. |
| #define hts221HygrometerResetBias | ( | devp | ) | hygrometerResetBias(&((devp)->hygro_if)) |
Reset bias values for the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| MSG_OK | if the function succeeded. |
| #define hts221HygrometerSetSensitivity | ( | devp, | |
| sp | |||
| ) | hygrometerSetSensitivity(&((devp)->hygro_if), sp) |
Set sensitivity values for the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| [in] | sp | a buffer which contains sensitivities. |
| MSG_OK | if the function succeeded. |
| #define hts221HygrometerResetSensitivity | ( | devp | ) | hygrometerResetSensitivity(&((devp)->hygro_if)) |
Reset sensitivity values for the BaseHygrometer.
| [in] | devp | pointer to HTS221Driver. |
| MSG_OK | if the function succeeded. |
| #define hts221ThermometerGetAxesNumber | ( | devp | ) | thermometerGetAxesNumber(&((devp)->thermo_if)) |
Return the number of axes of the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| #define hts221ThermometerReadRaw | ( | devp, | |
| axes | |||
| ) | thermometerReadRaw(&((devp)->thermo_if), axes) |
Retrieves raw data from the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| [out] | axes | a buffer which would be filled with raw data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
| #define hts221ThermometerReadCooked | ( | devp, | |
| axes | |||
| ) | thermometerReadCooked(&((devp)->thermo_if), axes) |
Retrieves cooked data from the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| [out] | axes | a buffer which would be filled with cooked data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
| #define hts221ThermometerSetBias | ( | devp, | |
| bp | |||
| ) | thermometerSetBias(&((devp)->thermo_if), bp) |
Set bias values for the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| [in] | bp | a buffer which contains biases. |
| MSG_OK | if the function succeeded. |
| #define hts221ThermometerResetBias | ( | devp | ) | thermometerResetBias(&((devp)->thermo_if)) |
Reset bias values for the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| MSG_OK | if the function succeeded. |
| #define hts221ThermometerSetSensitivity | ( | devp, | |
| sp | |||
| ) | thermometerSetSensitivity(&((devp)->thermo_if), sp) |
Set sensitivity values for the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| [in] | sp | a buffer which contains sensitivities. |
| MSG_OK | if the function succeeded. |
| #define hts221ThermometerResetSensitivity | ( | devp | ) | thermometerResetSensitivity(&((devp)->thermo_if)) |
Reset sensitivity values for the BaseThermometer.
| [in] | devp | pointer to HTS221Driver. |
| MSG_OK | if the function succeeded. |
| typedef struct HTS221Driver HTS221Driver |
| enum hts221_odr_t |
| enum hts221_avgh_t |
HTS221 humidity resolution.
| enum hts221_avgt_t |
HTS221 temperature resolution.
| enum hts221_bdu_t |
| enum hts221_state_t |
|
static |
Reads registers value using I2C.
| [in] | i2cp | pointer to the I2C interface |
| [in] | reg | first sub-register address |
| [out] | rxbuf | pointer to an output buffer |
| [in] | n | number of consecutive register to read |
Definition at line 69 of file hts221.c.
References i2cMasterTransmitTimeout(), and TIME_INFINITE.
Referenced by hts221Calibrate(), hygro_read_raw(), and thermo_read_raw().

Writes a value into a register using I2C.
| [in] | i2cp | pointer to the I2C interface |
| [in] | txbuf | buffer containing sub-address value in first position and values to write |
| [in] | n | size of txbuf less one (not considering the first element) |
Definition at line 92 of file hts221.c.
References i2cMasterTransmitTimeout(), and TIME_INFINITE.
Referenced by hts221Start(), and hts221Stop().

|
static |
Computes biases and sensitivities starting from data stored in calibration registers.
| [in] | devp | pointer to the HTS221 interface |
Definition at line 112 of file hts221.c.
References hts221I2CReadRegister().
Referenced by hts221Start().

|
static |
Return the number of axes of the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
Definition at line 173 of file hts221.c.
References HTS221_HYGRO_NUMBER_OF_AXES.
Referenced by thermo_reset_sensitivity().
|
static |
Retrieves raw data from the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
| [out] | axes | a buffer which would be filled with raw data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 195 of file hts221.c.
References HTS221_READY, hts221I2CReadRegister(), I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by hygro_read_cooked(), and thermo_reset_sensitivity().

|
static |
Retrieves cooked data from the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
| [out] | axes | a buffer which would be filled with cooked data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 249 of file hts221.c.
References HTS221_READY, hygro_read_raw(), objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().

|
static |
Set bias values for the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
| [in] | bp | a buffer which contains biases. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 284 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Reset bias values for the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
| MSG_OK | if the function succeeded. |
Definition at line 310 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Set sensitivity values for the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
| [in] | sp | a buffer which contains sensitivities. |
| MSG_OK | if the function succeeded. |
Definition at line 338 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Reset sensitivity values for the BaseHygrometer.
| [in] | ip | pointer to BaseHygrometer interface. |
| MSG_OK | if the function succeeded. |
Definition at line 363 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Return the number of axes of the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
Definition at line 386 of file hts221.c.
References HTS221_THERMO_NUMBER_OF_AXES.
Referenced by thermo_reset_sensitivity().
|
static |
Retrieves raw data from the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
| [out] | axes | a buffer which would be filled with raw data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 408 of file hts221.c.
References HTS221_READY, hts221I2CReadRegister(), I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_read_cooked(), and thermo_reset_sensitivity().

|
static |
Retrieves cooked data from the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
| [out] | axis | a buffer which would be filled with cooked data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 462 of file hts221.c.
References HTS221_READY, objGetInstance, osalDbgAssert, osalDbgCheck, and thermo_read_raw().
Referenced by thermo_reset_sensitivity().

|
static |
Set bias values for the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
| [in] | bp | a buffer which contains biases. |
| MSG_OK | if the function succeeded. |
Definition at line 494 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Reset bias values for the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
| MSG_OK | if the function succeeded. |
Definition at line 521 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Set sensitivity values for the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
| [in] | sp | a buffer which contains sensitivities. |
| MSG_OK | if the function succeeded. |
Definition at line 550 of file hts221.c.
References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by thermo_reset_sensitivity().
|
static |
Reset sensitivity values for the BaseThermometer.
| [in] | ip | pointer to BaseThermometer interface. |
| MSG_OK | if the function succeeded. |
Definition at line 576 of file hts221.c.
References HTS221_READY, hygro_get_axes_number(), hygro_read_cooked(), hygro_read_raw(), hygro_reset_bias(), hygro_reset_sensitivity(), hygro_set_bias(), hygro_set_sensitivity(), MSG_OK, objGetInstance, osalDbgAssert, osalDbgCheck, thermo_get_axes_number(), thermo_read_cooked(), thermo_read_raw(), thermo_reset_bias(), thermo_set_bias(), and thermo_set_sensitivity().

| void hts221ObjectInit | ( | HTS221Driver * | devp | ) |
Initializes an instance.
| [out] | devp | pointer to the HTS221Driver object |
Definition at line 622 of file hts221.c.
References HTS221_HYGRO_NUMBER_OF_AXES, HTS221_STOP, HTS221_THERMO_NUMBER_OF_AXES, HTS221Driver::hygro_if, HTS221Driver::thermo_if, BaseThermometer::vmt, BaseHygrometer::vmt, and HTS221Driver::vmt.
| void hts221Start | ( | HTS221Driver * | devp, |
| const HTS221Config * | config | ||
| ) |
Configures and activates HTS221 Complex Driver peripheral.
| [in] | devp | pointer to the HTS221Driver object |
| [in] | config | pointer to the HTS221Config object |
Definition at line 647 of file hts221.c.
References HTS221_READY, HTS221_STOP, hts221Calibrate(), hts221I2CWriteRegister(), i2cAcquireBus(), i2cReleaseBus(), i2cStart(), osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

| void hts221Stop | ( | HTS221Driver * | devp | ) |
Deactivates the HTS221 Complex Driver peripheral.
| [in] | devp | pointer to the HTS221Driver object |
Definition at line 755 of file hts221.c.
References HTS221_READY, HTS221_STOP, hts221I2CWriteRegister(), i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), osalDbgAssert, and osalDbgCheck.
