ZMOD4510 Nitrogen Dioxide and Ozone Firmware Documentation |

Modules | Files | Functions | Data Structures
HSxxxx Sensor API

API providing a unified interface for Renesas Humidity and Temperature sensors. More...

## Modules
| HS4xxx Sensor API
| HS4xxx Temperature/Humidity Sensor API.
| HS3xxx Sensor API
| HS3xxx Temperature/Humidity Sensor API.

## Files
file | hsxxxx.h
| Renesas humidity sensors (HS3xxx, HS4xxx) abstraction.

## Functions
int | HSxxxx_Init (HSxxxx_t *sensor, Interface_t *hal)
| Initialize the sensor object. More...
int | HSxxxx_Measure (HSxxxx_t *sensor, HSxxxx_Results_t *results)
| Perform one temperature measurement. More...
char const * | HSxxxx_Name (HSxxxx_t *sensor)
| Return the temperature/humidity sensor type name. More...

## Data Structures
struct | HSxxxx_Results_t
| Data structure holding humidity/temperature results. More...
struct | HSxxxx_t
| Data structure holding information required for HSxxxx API operation. More...

## Detailed Description

API providing a unified interface for Renesas Humidity and Temperature sensors.

The Renesas HS3xxx and HS4xxx are highly accurate, ultra-low power, fully calibrated relative humidity and temperature sensors. These sensors may be used as standalone sensors or used as companion sensor for humidity and temperature sensitive applications (e.g., for Renesas gas sensors).

The present API is provided as a unified interface to both of these sensor types.

HAL API ports to a customer specific hardware require the following function pointers of the Interface_t HAL data structure to be initialized and working as documented:

Function Pointer | Required
--- | ---
i2cRead | Mandatory
i2cWrite | Mandatory
msSleep | Mandatory
reset | Not required

## Data Structure Documentation

## ◆ HSxxxx_Results_t

struct HSxxxx_Results_t

Data structure holding humidity/temperature results.

### Data Fields
float | temperature
float | humidity

#### Field Documentation

## ◆ humidity

float humidity

Relative humidity

## ◆ temperature

float temperature

Temperature value in degree Celsius

## ◆ HSxxxx_t

struct HSxxxx_t

Data structure holding information required for HSxxxx API operation.

### Data Fields
Interface_t * | interface
uint8_t | i2cAddress

#### Field Documentation

## ◆ i2cAddress

uint8_t i2cAddress

I2C slave address of the HSxxxx sensor

## ◆ interface

Interface_t* interface

Pointer to the hal object for physical communication

## Function Documentation

## ◆ HSxxxx_Init()

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

Initialize the sensor object.

This function tries searching for a HS4xxx sensor first, by accessing the corresponding I2C address. If no such sensor is found, the function searches for a HS3xxx.

The type of sensor being detected can be determined using the function HSxxxx_Name().

Parameters

  sensor | Pointer to sensor object to be initialized.
  hal | Pointer to hal object for physical communication.

Returns
  int Error code

Return values

  0 | On success
  other | On error

## ◆ HSxxxx_Measure()

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

Perform one temperature measurement.

This function starts a temperature/humidity measurement and waits for the availability of the result before it returns.

Note
  This function is implemented as blocking function. Thus while the measurement is ongoing no other code is executed. Depending on the sensor the bocking time may be multiple tens of milliseconds.

Parameters

  sensor | Pointer to the sensor object to be used.
  results | Pointer to data structure for result storage.

Returns
  int Error code

Return values

  0 | On success
  other | On error

## ◆ HSxxxx_Name()

char const* HSxxxx_Name | ( | HSxxxx_t * | sensor | ) |

Return the temperature/humidity sensor type name.

The function HSxxxx_Init can identify different types of temperature/ humidity sensors. This function may be used to determine the sensor type that has been identified. The identification is performed based on the sensors I2C address.

Parameters

  sensor | Pointer to the sensor object to be queried.

Returns
  int Error code

Return values

  0 | On success
  other | On error