HTS221
Arduino library for the HTS221 humidity and temperature sensor
Loading...
Searching...
No Matches
Collaboration diagram for Public Functions:

Functions

HTS221_Error_et HTS221_ReadReg (void *handle, uint8_t RegAddr, uint16_t NumByteToRead, uint8_t *Data)
 
HTS221_Error_et HTS221_WriteReg (void *handle, uint8_t RegAddr, uint16_t NumByteToWrite, uint8_t *Data)
 
HTS221_Error_et HTS221_Get_DriverVersion (HTS221_DriverVersion_st *version)
 Get the version of this driver.
 
HTS221_Error_et HTS221_Get_DeviceID (void *handle, uint8_t *deviceid)
 Get device type ID.
 
HTS221_Error_et HTS221_Set_InitConfig (void *handle, HTS221_Init_st *pxInit)
 Initializes the HTS221 with the specified parameters in HTS221_Init_st struct.
 
HTS221_Error_et HTS221_Get_InitConfig (void *handle, HTS221_Init_st *pxInit)
 Returns a HTS221_Init_st struct with the actual configuration.
 
HTS221_Error_et HTS221_DeInit (void *handle)
 De initialization function for HTS221. This function put the HTS221 in power down, make a memory boot and clear the data output flags.
 
HTS221_Error_et HTS221_Get_Measurement (void *handle, uint16_t *humidity, int16_t *temperature)
 Read HTS221 output registers, and calculate humidity and temperature.
 
HTS221_Error_et HTS221_Get_RawMeasurement (void *handle, int16_t *humidity, int16_t *temperature)
 Read HTS221 output registers. Humidity and temperature.
 
HTS221_Error_et HTS221_Get_Humidity (void *handle, uint16_t *value)
 Read the humidity output and convert it using the factory calibration.
 
HTS221_Error_et HTS221_Get_HumidityRaw (void *handle, int16_t *value)
 Read HTS221 humidity output registers.
 
HTS221_Error_et HTS221_Get_Temperature (void *handle, int16_t *value)
 Read the temperature output and convert it using the factory calibration.
 
HTS221_Error_et HTS221_Get_TemperatureRaw (void *handle, int16_t *value)
 Read HTS221 temperature output registers.
 
HTS221_Error_et HTS221_Get_DataStatus (void *handle, HTS221_BitStatus_et *humidity, HTS221_BitStatus_et *temperature)
 Get the availability of new data for humidity and temperature.
 
HTS221_Error_et HTS221_Activate (void *handle)
 Exit from power down mode.
 
HTS221_Error_et HTS221_DeActivate (void *handle)
 Put the sensor in power down mode.
 
HTS221_Error_et HTS221_IsMeasurementCompleted (void *handle, HTS221_BitStatus_et *Is_Measurement_Completed)
 Check if the single measurement has completed.
 
HTS221_Error_et HTS221_Set_AvgHT (void *handle, HTS221_Avgh_et avgh, HTS221_Avgt_et avgt)
 Set_ humidity and temperature average mode.
 
HTS221_Error_et HTS221_Set_AvgH (void *handle, HTS221_Avgh_et avgh)
 Set humidity average mode.
 
HTS221_Error_et HTS221_Set_AvgT (void *handle, HTS221_Avgt_et avgt)
 Set temperature average mode.
 
HTS221_Error_et HTS221_Get_AvgHT (void *handle, HTS221_Avgh_et *avgh, HTS221_Avgt_et *avgt)
 Get humidity and temperature average mode.
 
HTS221_Error_et HTS221_Set_BduMode (void *handle, HTS221_State_et status)
 Set block data update mode.
 
HTS221_Error_et HTS221_Get_BduMode (void *handle, HTS221_State_et *status)
 Get block data update mode.
 
HTS221_Error_et HTS221_Set_PowerDownMode (void *handle, HTS221_BitStatus_et status)
 Enter or exit from power down mode.
 
HTS221_Error_et HTS221_Get_PowerDownMode (void *handle, HTS221_BitStatus_et *status)
 Get if HTS221 is in active mode or in power down mode.
 
HTS221_Error_et HTS221_Set_Odr (void *handle, HTS221_Odr_et odr)
 Set the output data rate mode.
 
HTS221_Error_et HTS221_Get_Odr (void *handle, HTS221_Odr_et *odr)
 Get the output data rate mode.
 
HTS221_Error_et HTS221_MemoryBoot (void *handle)
 Reboot Memory Content.
 
HTS221_Error_et HTS221_Set_HeaterState (void *handle, HTS221_State_et status)
 Configure the internal heater.
 
HTS221_Error_et HTS221_Get_HeaterState (void *handle, HTS221_State_et *status)
 Get the internal heater.
 
HTS221_Error_et HTS221_StartOneShotMeasurement (void *handle)
 Set ONE_SHOT bit to start a new conversion (ODR mode has to be 00). Once the measurement is done, ONE_SHOT bit is self-cleared.
 
HTS221_Error_et HTS221_Set_IrqActiveLevel (void *handle, HTS221_DrdyLevel_et status)
 Set level configuration of the interrupt pin DRDY.
 
HTS221_Error_et HTS221_Get_IrqActiveLevel (void *handle, HTS221_DrdyLevel_et *status)
 Get level configuration of the interrupt pin DRDY.
 
HTS221_Error_et HTS221_Set_IrqOutputType (void *handle, HTS221_OutputType_et value)
 Set Push-pull/open drain configuration for the interrupt pin DRDY.
 
HTS221_Error_et HTS221_Get_IrqOutputType (void *handle, HTS221_OutputType_et *value)
 Get the configuration for the interrupt pin DRDY.
 
HTS221_Error_et HTS221_Set_IrqEnable (void *handle, HTS221_State_et status)
 Enable/disable the interrupt mode.
 
HTS221_Error_et HTS221_Get_IrqEnable (void *handle, HTS221_State_et *status)
 Get the interrupt mode.
 
void HTS221_assert_failed (uint8_t *file, uint32_t line)
 Reports the name of the source file and the source line number where the assert_param error has occurred.
 

Detailed Description

Function Documentation

◆ HTS221_Activate()

HTS221_Error_et HTS221_Activate ( void *  handle)

Exit from power down mode.

Parameters
handleDevice handle.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_assert_failed()

void HTS221_assert_failed ( uint8_t *  file,
uint32_t  line 
)

Reports the name of the source file and the source line number where the assert_param error has occurred.

Parameters
filePointer to the source file name.
lineSource line number where the assert_param error occurred.

◆ HTS221_DeActivate()

HTS221_Error_et HTS221_DeActivate ( void *  handle)

Put the sensor in power down mode.

Parameters
handleDevice handle.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_DeInit()

HTS221_Error_et HTS221_DeInit ( void *  handle)

De initialization function for HTS221. This function put the HTS221 in power down, make a memory boot and clear the data output flags.

Parameters
handleDevice handle.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_AvgHT()

HTS221_Error_et HTS221_Get_AvgHT ( void *  handle,
HTS221_Avgh_et *  avgh,
HTS221_Avgt_et *  avgt 
)

Get humidity and temperature average mode.

Parameters
handleDevice handle.
avghpointer to the returned value with the humidity average mode.
avgtpointer to the returned value with the temperature average mode.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_BduMode()

HTS221_Error_et HTS221_Get_BduMode ( void *  handle,
HTS221_State_et *  status 
)

Get block data update mode.

Parameters
handleDevice handle.
statusReceives the block data update setting.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_DataStatus()

HTS221_Error_et HTS221_Get_DataStatus ( void *  handle,
HTS221_BitStatus_et *  humidity,
HTS221_BitStatus_et *  temperature 
)

Get the availability of new data for humidity and temperature.

Parameters
handleDevice handle.
humiditypointer to the returned humidity data status [HTS221_SET/HTS221_RESET].
temperaturepointer to the returned temperature data status [HTS221_SET/HTS221_RESET]. This parameter is a pointer to HTS221_BitStatus_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_DeviceID()

HTS221_Error_et HTS221_Get_DeviceID ( void *  handle,
uint8_t *  deviceid 
)

Get device type ID.

Parameters
handleDevice handle.
deviceidpointer to the returned device type ID.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_DriverVersion()

HTS221_Error_et HTS221_Get_DriverVersion ( HTS221_DriverVersion_st *  version)

Get the version of this driver.

Parameters
versionPointer to a HTS221_DriverVersion_st structure that contains the version information. This parameter is a pointer to HTS221_DriverVersion_st.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_HeaterState()

HTS221_Error_et HTS221_Get_HeaterState ( void *  handle,
HTS221_State_et *  status 
)

Get the internal heater.

Parameters
handleDevice handle.
statusReceives the internal heater state.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_Humidity()

HTS221_Error_et HTS221_Get_Humidity ( void *  handle,
uint16_t *  value 
)

Read the humidity output and convert it using the factory calibration.

Parameters
handleDevice handle.
valuePointer to the humidity result in tenths of a percent (0-1000).
Return values
HTS221_OKon success, or HTS221_ERROR if a register read fails.

◆ HTS221_Get_HumidityRaw()

HTS221_Error_et HTS221_Get_HumidityRaw ( void *  handle,
int16_t *  value 
)

Read HTS221 humidity output registers.

Parameters
handleDevice handle.
valueDestination for the raw humidity value.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_InitConfig()

HTS221_Error_et HTS221_Get_InitConfig ( void *  handle,
HTS221_Init_st *  pxInit 
)

Returns a HTS221_Init_st struct with the actual configuration.

Parameters
handleDevice handle.
pxInitpointer to a HTS221_Init_st structure. This parameter is a pointer to HTS221_Init_st.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_IrqActiveLevel()

HTS221_Error_et HTS221_Get_IrqActiveLevel ( void *  handle,
HTS221_DrdyLevel_et *  status 
)

Get level configuration of the interrupt pin DRDY.

Parameters
handleDevice handle.
statusReceives the active level selection.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_IrqEnable()

HTS221_Error_et HTS221_Get_IrqEnable ( void *  handle,
HTS221_State_et *  status 
)

Get the interrupt mode.

Parameters
handleDevice handle.
statusReceives the interrupt mode setting.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_IrqOutputType()

HTS221_Error_et HTS221_Get_IrqOutputType ( void *  handle,
HTS221_OutputType_et *  value 
)

Get the configuration for the interrupt pin DRDY.

Parameters
handleDevice handle.
valueReceives the output type configuration.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_Measurement()

HTS221_Error_et HTS221_Get_Measurement ( void *  handle,
uint16_t *  humidity,
int16_t *  temperature 
)

Read HTS221 output registers, and calculate humidity and temperature.

Parameters
handleDevice handle.
humiditypointer to the returned humidity value that must be divided by 10 to get the value in [%].
temperaturepointer to the returned temperature value that must be divided by 10 to get the value in ['C].
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_Odr()

HTS221_Error_et HTS221_Get_Odr ( void *  handle,
HTS221_Odr_et *  odr 
)

Get the output data rate mode.

Parameters
handleDevice handle.
odrReceives the output data rate mode.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_PowerDownMode()

HTS221_Error_et HTS221_Get_PowerDownMode ( void *  handle,
HTS221_BitStatus_et *  status 
)

Get if HTS221 is in active mode or in power down mode.

Parameters
handleDevice handle.
statusReceives the power-down bit value.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_RawMeasurement()

HTS221_Error_et HTS221_Get_RawMeasurement ( void *  handle,
int16_t *  humidity,
int16_t *  temperature 
)

Read HTS221 output registers. Humidity and temperature.

Parameters
handleDevice handle.
humiditypointer to the returned humidity raw value.
temperaturepointer to the returned temperature raw value.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Get_Temperature()

HTS221_Error_et HTS221_Get_Temperature ( void *  handle,
int16_t *  value 
)

Read the temperature output and convert it using the factory calibration.

Parameters
handleDevice handle.
valuePointer to the temperature result in tenths of a degree Celsius.
Return values
HTS221_OKon success, or HTS221_ERROR if a register read fails.

◆ HTS221_Get_TemperatureRaw()

HTS221_Error_et HTS221_Get_TemperatureRaw ( void *  handle,
int16_t *  value 
)

Read HTS221 temperature output registers.

Parameters
handleDevice handle.
valueDestination for the raw temperature value.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_IsMeasurementCompleted()

HTS221_Error_et HTS221_IsMeasurementCompleted ( void *  handle,
HTS221_BitStatus_et *  Is_Measurement_Completed 
)

Check if the single measurement has completed.

Parameters
handleDevice handle.
Is_Measurement_CompletedReceives whether the measurement is complete.
Return values
Status[HTS221_ERROR, HTS221_OK]

◆ HTS221_MemoryBoot()

HTS221_Error_et HTS221_MemoryBoot ( void *  handle)

Reboot Memory Content.

Parameters
handleDevice handle.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_ReadReg()

HTS221_Error_et HTS221_ReadReg ( void *  handle,
uint8_t  RegAddr,
uint16_t  NumByteToRead,
uint8_t *  Data 
)

◆ HTS221_Set_AvgH()

HTS221_Error_et HTS221_Set_AvgH ( void *  handle,
HTS221_Avgh_et  avgh 
)

Set humidity average mode.

Parameters
handleDevice handle.
avghis the average mode for humidity, this parameter is HTS221_Avgh_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_AvgHT()

HTS221_Error_et HTS221_Set_AvgHT ( void *  handle,
HTS221_Avgh_et  avgh,
HTS221_Avgt_et  avgt 
)

Set_ humidity and temperature average mode.

Parameters
handleDevice handle.
avghis the average mode for humidity, this parameter is HTS221_Avgh_et.
avgtis the average mode for temperature, this parameter is HTS221_Avgt_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_AvgT()

HTS221_Error_et HTS221_Set_AvgT ( void *  handle,
HTS221_Avgt_et  avgt 
)

Set temperature average mode.

Parameters
handleDevice handle.
avgtis the average mode for temperature, this parameter is HTS221_Avgt_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_BduMode()

HTS221_Error_et HTS221_Set_BduMode ( void *  handle,
HTS221_State_et  status 
)

Set block data update mode.

Parameters
handleDevice handle.
statusHTS221_ENABLE holds output data until both bytes are read; HTS221_DISABLE allows continuous updates. This parameter is a HTS221_BitStatus_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_HeaterState()

HTS221_Error_et HTS221_Set_HeaterState ( void *  handle,
HTS221_State_et  status 
)

Configure the internal heater.

Parameters
handleDevice handle.
statusInternal heater state [HTS221_ENABLE/HTS221_DISABLE]. This parameter is a HTS221_State_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR]

◆ HTS221_Set_InitConfig()

HTS221_Error_et HTS221_Set_InitConfig ( void *  handle,
HTS221_Init_st *  pxInit 
)

Initializes the HTS221 with the specified parameters in HTS221_Init_st struct.

Parameters
handleDevice handle.
pxInitpointer to a HTS221_Init_st structure that contains the configuration. This parameter is a pointer to HTS221_Init_st.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_IrqActiveLevel()

HTS221_Error_et HTS221_Set_IrqActiveLevel ( void *  handle,
HTS221_DrdyLevel_et  status 
)

Set level configuration of the interrupt pin DRDY.

Parameters
handleDevice handle.
statusActive level selection (HTS221_LOW_LVL or HTS221_HIGH_LVL). This parameter is a HTS221_DrdyLevel_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_IrqEnable()

HTS221_Error_et HTS221_Set_IrqEnable ( void *  handle,
HTS221_State_et  status 
)

Enable/disable the interrupt mode.

Parameters
handleDevice handle.
statusis the enable/disable for the interrupt mode. This parameter is a HTS221_State_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_IrqOutputType()

HTS221_Error_et HTS221_Set_IrqOutputType ( void *  handle,
HTS221_OutputType_et  value 
)

Set Push-pull/open drain configuration for the interrupt pin DRDY.

Parameters
handleDevice handle.
valueis the output type configuration. This parameter is a HTS221_OutputType_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_Odr()

HTS221_Error_et HTS221_Set_Odr ( void *  handle,
HTS221_Odr_et  odr 
)

Set the output data rate mode.

Parameters
handleDevice handle.
odrOutput data rate to set. This parameter is a HTS221_Odr_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_Set_PowerDownMode()

HTS221_Error_et HTS221_Set_PowerDownMode ( void *  handle,
HTS221_BitStatus_et  status 
)

Enter or exit from power down mode.

Parameters
handleDevice handle.
statusSet HTS221_SET for power-down mode or HTS221_RESET for active mode. This parameter is a HTS221_BitStatus_et.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_StartOneShotMeasurement()

HTS221_Error_et HTS221_StartOneShotMeasurement ( void *  handle)

Set ONE_SHOT bit to start a new conversion (ODR mode has to be 00). Once the measurement is done, ONE_SHOT bit is self-cleared.

Parameters
handleDevice handle.
Return values
Errorcode [HTS221_OK, HTS221_ERROR].

◆ HTS221_WriteReg()

HTS221_Error_et HTS221_WriteReg ( void *  handle,
uint8_t  RegAddr,
uint16_t  NumByteToWrite,
uint8_t *  Data 
)