ChibiOS  0.0.0
Collaboration diagram for HTS221:

Detailed Description

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.1"
 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   1
 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 communication interfaces related bit masks

#define HTS221_DI_MASK   0xFF
 
#define HTS221_DI(n)   (1 << n)
 
#define HTS221_AD_MASK   0x3F
 
#define HTS221_AD(n)   (1 << n)
 
#define HTS221_MS   (1 << 6)
 
#define HTS221_RW   (1 << 7)
 
#define HTS221_SUB_MS   (1 << 7)
 
#define HTS221_SAD   0x5F
 

HTS221 register addresses

#define HTS221_AD_WHO_AM_I   0x0F
 
#define HTS221_AD_AV_CONF   0x10
 
#define HTS221_AD_CTRL_REG1   0x20
 
#define HTS221_AD_CTRL_REG2   0x21
 
#define HTS221_AD_CTRL_REG3   0x22
 
#define HTS221_AD_STATUS_REG   0x27
 
#define HTS221_AD_HUMIDITY_OUT_L   0x28
 
#define HTS221_AD_HUMIDITY_OUT_H   0x29
 
#define HTS221_AD_TEMP_OUT_L   0x2A
 
#define HTS221_AD_TEMP_OUT_H   0x2B
 
#define HTS221_AD_CALIB_0   0x30
 
#define HTS221_AD_CALIB_1   0x31
 
#define HTS221_AD_CALIB_2   0x32
 
#define HTS221_AD_CALIB_3   0x33
 
#define HTS221_AD_CALIB_4   0x34
 
#define HTS221_AD_CALIB_5   0x35
 
#define HTS221_AD_CALIB_6   0x36
 
#define HTS221_AD_CALIB_7   0x37
 
#define HTS221_AD_CALIB_8   0x38
 
#define HTS221_AD_CALIB_9   0x39
 
#define HTS221_AD_CALIB_A   0x3A
 
#define HTS221_AD_CALIB_B   0x3B
 
#define HTS221_AD_CALIB_C   0x3C
 
#define HTS221_AD_CALIB_D   0x3D
 
#define HTS221_AD_CALIB_E   0x3E
 
#define HTS221_AD_CALIB_F   0x3F
 

HTS221_CTRL_REG1 register bits definitions

#define HTS221_CTRL_REG1_MASK   0x87
 
#define HTS221_CTRL_REG1_ODR0   (1 << 0)
 
#define HTS221_CTRL_REG1_ODR1   (1 << 1)
 
#define HTS221_CTRL_REG1_BDU   (1 << 2)
 
#define HTS221_CTRL_REG1_PD   (1 << 7)
 

HTS221_CTRL_REG2 register bits definitions

#define HTS221_CTRL_REG2_MASK   0x83
 
#define HTS221_CTRL_REG2_ONE_SHOT   (1 << 0)
 
#define HTS221_CTRL_REG2_HEATER   (1 << 1)
 
#define HTS221_CTRL_REG2_BOOT   (1 << 7)
 

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.

Todo:
Add support for HTS221 over SPI.
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...
 

Macro Definition Documentation

#define EX_HTS221_VERSION   "1.1.1"

HTS221 driver version string.

Definition at line 47 of file hts221.h.

#define EX_HTS221_MAJOR   1

HTS221 driver version major number.

Definition at line 52 of file hts221.h.

#define EX_HTS221_MINOR   1

HTS221 driver version minor number.

Definition at line 57 of file hts221.h.

#define EX_HTS221_PATCH   1

HTS221 driver version patch number.

Definition at line 62 of file hts221.h.

#define HTS221_HYGRO_NUMBER_OF_AXES   1U

HTS221 hygrometer subsystem characteristics.

Note
Sensitivity is expressed as rH/LSB whereas rH stand for percentage of relative humidity.
Bias is expressed as rH.

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.

Note
Sensitivity is expressed as °C/LSB.
Bias is expressed as °C.

Definition at line 85 of file hts221.h.

Referenced by hts221ObjectInit(), and thermo_get_axes_number().

#define HTS221_USE_SPI   FALSE

HTS221 SPI interface switch.

If set to TRUE the support for SPI is included.

Note
The default is FALSE.

Definition at line 184 of file hts221.h.

#define HTS221_SHARED_SPI   FALSE

HTS221 shared SPI switch.

If set to TRUE the device acquires SPI bus ownership on each transaction.

Note
The default is FALSE. Requires SPI_USE_MUTUAL_EXCLUSION

Definition at line 194 of file hts221.h.

#define HTS221_USE_I2C   TRUE

HTS221 I2C interface switch.

If set to TRUE the support for I2C is included.

Note
The default is TRUE.

Definition at line 203 of file hts221.h.

#define HTS221_SHARED_I2C   FALSE

HTS221 shared I2C switch.

If set to TRUE the device acquires I2C bus ownership on each transaction.

Note
The default is FALSE. Requires I2C_USE_MUTUAL_EXCLUSION

Definition at line 213 of file hts221.h.

#define HTS221_USE_ADVANCED   FALSE

HTS221 advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 222 of file hts221.h.

#define _hts221_methods_alone

HTS221 specific methods.

Note
No methods so far, just a common ancestor interface.

Definition at line 390 of file hts221.h.

#define _hts221_methods
Value:
#define _hts221_methods_alone
HTS221 specific methods.
Definition: hts221.h:390

HTS221 specific methods with inherited ones.

Definition at line 395 of file hts221.h.

#define _hts221_data
Value:
/* Driver state.*/ \
/* Current configuration data.*/ \
const HTS221Config *config; \
/* Hygrometer subsystem axes number.*/ \
size_t hygroaxes; \
/* Hygrometer subsystem current sensitivity.*/ \
float hygrosensitivity; \
/* Hygrometer subsystem current bias .*/ \
float hygrobias; \
/* Hygrometer subsystem factory sensitivity.*/ \
float hygrofactorysensitivity; \
/* Hygrometer subsystem factory bias .*/ \
float hygrofactorybias; \
/* Thermometer subsystem axes number.*/ \
size_t thermoaxes; \
/* Thermometer subsystem current sensitivity.*/ \
float thermosensitivity; \
/* Thermometer subsystem current bias.*/ \
float thermobias; \
/* Thermometer subsystem factory sensitivity.*/ \
float thermofactorysensitivity; \
/* Thermometer subsystem factory bias.*/ \
float thermofactorybias;
hts221_state_t
Driver state machine possible states.
Definition: hts221.h:319
HTS221 configuration structure.
Definition: hts221.h:328

HTS221Driver specific data.

Definition at line 411 of file hts221.h.

#define hts221HygrometerGetAxesNumber (   devp)    hygrometerGetAxesNumber(&((devp)->hygro_if))

Return the number of axes of the BaseHygrometer.

Parameters
[in]devppointer to HTS221Driver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 464 of file hts221.h.

#define hts221HygrometerReadRaw (   devp,
  axes 
)    hygrometerReadRaw(&((devp)->hygro_if), axes)

Retrieves raw data from the BaseHygrometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 485 of file hts221.h.

#define hts221HygrometerReadCooked (   devp,
  axes 
)    hygrometerReadCooked(&((devp)->hygro_if), axes)

Retrieves cooked data from the BaseHygrometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as rH.
The axes array must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 507 of file hts221.h.

#define hts221HygrometerSetBias (   devp,
  bp 
)    hygrometerSetBias(&((devp)->hygro_if), bp)

Set bias values for the BaseHygrometer.

Note
Bias must be expressed as rH.
The bias buffer must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 524 of file hts221.h.

#define hts221HygrometerResetBias (   devp)    hygrometerResetBias(&((devp)->hygro_if))

Reset bias values for the BaseHygrometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to HTS221Driver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 539 of file hts221.h.

#define hts221HygrometerSetSensitivity (   devp,
  sp 
)    hygrometerSetSensitivity(&((devp)->hygro_if), sp)

Set sensitivity values for the BaseHygrometer.

Note
Sensitivity must be expressed as rH/LSB.
The sensitivity buffer must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 556 of file hts221.h.

#define hts221HygrometerResetSensitivity (   devp)    hygrometerResetSensitivity(&((devp)->hygro_if))

Reset sensitivity values for the BaseHygrometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to HTS221Driver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 570 of file hts221.h.

#define hts221ThermometerGetAxesNumber (   devp)    thermometerGetAxesNumber(&((devp)->thermo_if))

Return the number of axes of the BaseThermometer.

Parameters
[in]devppointer to HTS221Driver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 582 of file hts221.h.

#define hts221ThermometerReadRaw (   devp,
  axes 
)    thermometerReadRaw(&((devp)->thermo_if), axes)

Retrieves raw data from the BaseThermometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 603 of file hts221.h.

#define hts221ThermometerReadCooked (   devp,
  axes 
)    thermometerReadCooked(&((devp)->thermo_if), axes)

Retrieves cooked data from the BaseThermometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as °C.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 625 of file hts221.h.

#define hts221ThermometerSetBias (   devp,
  bp 
)    thermometerSetBias(&((devp)->thermo_if), bp)

Set bias values for the BaseThermometer.

Note
Bias must be expressed as °C.
The bias buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 642 of file hts221.h.

#define hts221ThermometerResetBias (   devp)    thermometerResetBias(&((devp)->thermo_if))

Reset bias values for the BaseThermometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to HTS221Driver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 657 of file hts221.h.

#define hts221ThermometerSetSensitivity (   devp,
  sp 
)    thermometerSetSensitivity(&((devp)->thermo_if), sp)

Set sensitivity values for the BaseThermometer.

Note
Sensitivity must be expressed as °C/LSB.
The sensitivity buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to HTS221Driver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 674 of file hts221.h.

#define hts221ThermometerResetSensitivity (   devp)    thermometerResetSensitivity(&((devp)->thermo_if))

Reset sensitivity values for the BaseThermometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to HTS221Driver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 688 of file hts221.h.

Typedef Documentation

typedef struct HTS221Driver HTS221Driver

Structure representing a HTS221 driver.

Definition at line 268 of file hts221.h.

Enumeration Type Documentation

HTS221 output data rate and bandwidth.

Enumerator
HTS221_ODR_ONE_SHOT 

One shot.

HTS221_ODR_1HZ 

Output data rate 1 Hz.

HTS221_ODR_7HZ 

Output data rate 7 Hz.

HTS221_ODR_12P5HZ 

Output data rate 12.5 Hz.

Definition at line 273 of file hts221.h.

HTS221 humidity resolution.

Enumerator
HTS221_AVGH_4 

Number of internal average is 4.

HTS221_AVGH_8 

Number of internal average is 8.

HTS221_AVGH_16 

Number of internal average is 16.

HTS221_AVGH_32 

Number of internal average is 32.

HTS221_AVGH_64 

Number of internal average is 64.

HTS221_AVGH_128 

Number of internal average is 128.

HTS221_AVGH_256 

Number of internal average is 256.

HTS221_AVGH_512 

Number of internal average is 512.

Definition at line 283 of file hts221.h.

HTS221 temperature resolution.

Enumerator
HTS221_AVGT_2 

Number of internal average is 2.

HTS221_AVGT_4 

Number of internal average is 4.

HTS221_AVGT_8 

Number of internal average is 8.

HTS221_AVGT_16 

Number of internal average is 16.

HTS221_AVGT_32 

Number of internal average is 32.

HTS221_AVGT_64 

Number of internal average is 64.

HTS221_AVGT_128 

Number of internal average is 128.

HTS221_AVGT_256 

Number of internal average is 256.

Definition at line 297 of file hts221.h.

HTS221 block data update.

Enumerator
HTS221_BDU_CONTINUOUS 

Block data continuously updated.

HTS221_BDU_BLOCKED 

Block data updated after reading.

Definition at line 311 of file hts221.h.

Driver state machine possible states.

Enumerator
HTS221_UNINIT 

Not initialized.

HTS221_STOP 

Stopped.

HTS221_READY 

Ready.

Definition at line 319 of file hts221.h.

Function Documentation

static msg_t hts221I2CReadRegister ( I2CDriver i2cp,
uint8_t  reg,
uint8_t *  rxbuf,
size_t  n 
)
static

Reads registers value using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]i2cppointer to the I2C interface
[in]regfirst sub-register address
[out]rxbufpointer to an output buffer
[in]nnumber of consecutive register to read
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 69 of file hts221.c.

References i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by hts221Calibrate(), hygro_read_raw(), and thermo_read_raw().

Here is the call graph for this function:

static msg_t hts221I2CWriteRegister ( I2CDriver i2cp,
uint8_t *  txbuf,
size_t  n 
)
static

Writes a value into a register using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]i2cppointer to the I2C interface
[in]txbufbuffer containing sub-address value in first position and values to write
[in]nsize of txbuf less one (not considering the first element)
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 92 of file hts221.c.

References i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by hts221Start(), and hts221Stop().

Here is the call graph for this function:

static msg_t hts221Calibrate ( HTS221Driver devp)
static

Computes biases and sensitivities starting from data stored in calibration registers.

Note
Factory bias and sensitivity values are stored into the driver structure.
Parameters
[in]devppointer to the HTS221 interface
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 112 of file hts221.c.

References hts221I2CReadRegister(), i2cAcquireBus(), i2cReleaseBus(), and i2cStart().

Referenced by hts221Start().

Here is the call graph for this function:

static size_t hygro_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseHygrometer.

Parameters
[in]ippointer to BaseHygrometer interface.
Returns
the number of axes.

Definition at line 182 of file hts221.c.

References HTS221_HYGRO_NUMBER_OF_AXES.

Referenced by thermo_reset_sensitivity().

static msg_t hygro_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseHygrometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]ippointer to BaseHygrometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 204 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().

Here is the call graph for this function:

static msg_t hygro_read_cooked ( void *  ip,
float  axes[] 
)
static

Retrieves cooked data from the BaseHygrometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as rH.
The axes array must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]ippointer to BaseHygrometer interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 258 of file hts221.c.

References HTS221_READY, hygro_read_raw(), objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

Here is the call graph for this function:

static msg_t hygro_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseHygrometer.

Note
Bias must be expressed as rH.
The bias buffer must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]ippointer to BaseHygrometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 293 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t hygro_reset_bias ( void *  ip)
static

Reset bias values for the BaseHygrometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseHygrometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 319 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t hygro_set_sensitivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseHygrometer.

Note
Sensitivity must be expressed as rH/LSB.
The sensitivity buffer must be at least the same size of the BaseHygrometer axes number.
Parameters
[in]ippointer to BaseHygrometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 347 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t hygro_reset_sensitivity ( void *  ip)
static

Reset sensitivity values for the BaseHygrometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseHygrometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 372 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static size_t thermo_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseThermometer.

Parameters
[in]ippointer to BaseThermometer interface.
Returns
the number of axes.

Definition at line 395 of file hts221.c.

References HTS221_THERMO_NUMBER_OF_AXES.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseThermometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 417 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().

Here is the call graph for this function:

static msg_t thermo_read_cooked ( void *  ip,
float *  axis 
)
static

Retrieves cooked data from the BaseThermometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as °C.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[out]axisa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 471 of file hts221.c.

References HTS221_READY, objGetInstance, osalDbgAssert, osalDbgCheck, and thermo_read_raw().

Referenced by thermo_reset_sensitivity().

Here is the call graph for this function:

static msg_t thermo_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseThermometer.

Note
Bias must be expressed as °C.
The bias buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 503 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_reset_bias ( void *  ip)
static

Reset bias values for the BaseThermometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseThermometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 530 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_set_sensitivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseThermometer.

Note
Sensitivity must be expressed as °C/LSB.
The sensitivity buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 559 of file hts221.c.

References HTS221_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_reset_sensitivity ( void *  ip)
static

Reset sensitivity values for the BaseThermometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseThermometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 585 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().

Here is the call graph for this function:

void hts221ObjectInit ( HTS221Driver devp)

Initializes an instance.

Parameters
[out]devppointer to the HTS221Driver object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 631 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.

Parameters
[in]devppointer to the HTS221Driver object
[in]configpointer to the HTS221Config object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 656 of file hts221.c.

References HTS221_READY, HTS221_STOP, hts221Calibrate(), hts221I2CWriteRegister(), i2cAcquireBus(), i2cReleaseBus(), i2cStart(), osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

Here is the call graph for this function:

void hts221Stop ( HTS221Driver devp)

Deactivates the HTS221 Complex Driver peripheral.

Parameters
[in]devppointer to the HTS221Driver object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 761 of file hts221.c.

References HTS221_READY, HTS221_STOP, hts221I2CWriteRegister(), i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function: