ZMOD4510 Ultra-Low Power Ozone Firmware Documentation |

Files | Functions | Enumerations
HS3xxx Sensor API
HSxxxx Sensor API

HS3xxx Temperature/Humidity Sensor API. More...

## Files
file | hs3xxx.h
| HS3xxx sensor declarations.

## Functions
int | HS3xxx_Init (HSxxxx_t *sensor, Interface_t *hal)
| Initialize the sensor object. More...
int | HS3xxx_ReadID (HSxxxx_t *sensor, uint32_t *id)
| Read the unique sensor ID of the HS3xxx. More...
int | HS3xxx_Measure (HSxxxx_t *sensor, HSxxxx_Results_t *results)
| Execute a temperature/humidity measurement cycle. More...
int | HS3xxx_MeasureStart (HSxxxx_t *sensor)
| Start a temperature/humidity measurement cycle. More...
int | HS3xxx_MeasureRead (HSxxxx_t *sensor, HSxxxx_Results_t *results)
| Read temperature/humidity results. More...

## Enumerations
enum | HS3xxx_ErrorCodes_t { hteStaleData = 1 }
| Error code definitions specific for the HS3xxx API. More...

## Detailed Description

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.

## Enumeration Type Documentation

## ◆ HS3xxx_ErrorCodes_t

enum HS3xxx_ErrorCodes_t

Error code definitions specific for the HS3xxx API.

Enumerator
hteStaleData | Sensor reported stale data.

## Function Documentation

## ◆ HS3xxx_Init()

int HS3xxx_Init | ( | HSxxxx_t * | sensor,
|  | Interface_t * | hal
| ) |  |

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()

int HS3xxx_Measure | ( | HSxxxx_t * | sensor,
|  | HSxxxx_Results_t * | results
| ) |  |

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()

int HS3xxx_MeasureRead | ( | HSxxxx_t * | sensor,
|  | HSxxxx_Results_t * | results
| ) |  |

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