temphum18 2.0.0.0
Temp&Hum 18 Click Driver

API for configuring and manipulating Temp&Hum 18 Click driver. More...

Topics

 Temp&Hum 18 Registers List
 List of registers of Temp&Hum 18 Click driver.
 
 Temp&Hum 18 Command List
 List of commands of Temp&Hum 18 Click driver.
 
 Temp&Hum 18 status bits
 List of status bits of Temp&Hum 18 Click driver.
 
 Temp&Hum 18 Registers Settings
 Settings for registers of Temp&Hum 18 Click driver.
 
 Temp&Hum 18 MikroBUS Map
 MikroBUS pin mapping of Temp&Hum 18 Click driver.
 

Functions

void temphum18_cfg_setup (temphum18_cfg_t *cfg)
 Temp&Hum 18 configuration object setup function.
 
err_t temphum18_init (temphum18_t *ctx, temphum18_cfg_t *cfg)
 Temp&Hum 18 initialization function.
 
err_t temphum18_default_cfg (temphum18_t *ctx)
 Temp&Hum 18 default configuration function.
 
err_t temphum18_generic_write (temphum18_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Temp&Hum 18 I2C writing function.
 
err_t temphum18_generic_read (temphum18_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Temp&Hum 18 I2C reading function.
 
err_t temphum18_wake_up (temphum18_t *ctx)
 Temp&Hum 18 wake up function.
 
err_t temphum18_get_raw_data (temphum18_t *ctx, uint8_t resolution, int16_t *temp, uint16_t *hum, uint8_t *status)
 Temp&Hum 18 get raw data function.
 
err_t temphum18_get_temp_hum (temphum18_t *ctx, uint8_t resolution, float *temperature, float *humidity)
 Temp&Hum 18 get temperature and humidity function.
 
err_t temphum18_enter_programming_mode (temphum18_t *ctx)
 Temp&Hum 18 enter programming mode function.
 
err_t temphum18_enter_measurements_mode (temphum18_t *ctx)
 Temp&Hum 18 enter measurements mode function.
 
err_t temphum18_set_relative_humidity_resolution (temphum18_t *ctx, uint8_t resolution)
 Temp&Hum 18 set relative humidity resolution function.
 
err_t temphum18_set_temperature_resolution (temphum18_t *ctx, uint8_t resolution)
 Temp&Hum 18 set relative temperature resolution function.
 

Detailed Description

API for configuring and manipulating Temp&Hum 18 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ temphum18_cfg_setup()

void temphum18_cfg_setup ( temphum18_cfg_t * cfg)

Temp&Hum 18 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See temphum18_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ temphum18_default_cfg()

err_t temphum18_default_cfg ( temphum18_t * ctx)

Temp&Hum 18 default configuration function.

This function executes a default configuration of Temp&Hum 18 click board.

Parameters
[in]ctx: Click context object. See temphum18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ temphum18_enter_measurements_mode()

err_t temphum18_enter_measurements_mode ( temphum18_t * ctx)

Temp&Hum 18 enter measurements mode function.

This function enter measurements mode, exit programming mode of the HS3003 High Performance Relative Humidity and Temperature Sensor on the Temp&Hum 18 click board™.

Parameters
[in]ctx: Click context object. See temphum18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum18_enter_programming_mode()

err_t temphum18_enter_programming_mode ( temphum18_t * ctx)

Temp&Hum 18 enter programming mode function.

This function enter programming mode, accessing the non-volatile memory of the HS3003 High Performance Relative Humidity and Temperature Sensor on the Temp&Hum 18 click board™.

Parameters
[in]ctx: Click context object. See temphum18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
To enter the programming mode, you must call the function within 10 ms after the sensor has been powered on.

◆ temphum18_generic_read()

err_t temphum18_generic_read ( temphum18_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Temp&Hum 18 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum18_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum18_generic_write()

err_t temphum18_generic_write ( temphum18_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Temp&Hum 18 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum18_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum18_get_raw_data()

err_t temphum18_get_raw_data ( temphum18_t * ctx,
uint8_t resolution,
int16_t * temp,
uint16_t * hum,
uint8_t * status )

Temp&Hum 18 get raw data function.

This function get raw data of the HS3003 High Performance Relative Humidity and Temperature Sensor on the Temp&Hum 18 click board™.

Parameters
[in]ctx: Click context object.
[in]resolution:
  • 0x00 ( TEMPHUM18_RESOLUTION_8_BITS ) - 8 bit resolution,
  • 0x01 ( TEMPHUM18_RESOLUTION_10_BITS ) - 10 bit resolution,
  • 0x02 ( TEMPHUM18_RESOLUTION_12_BITS ) - 12 bit resolution,
  • 0x03 ( TEMPHUM18_RESOLUTION_14_BITS ) - 14 bit resolution.
[out]temp: Output read Temperature ( RAW ) data.
[out]hum: Output read Humidity ( RAW ) data.
[out]status:
  • 0x00 ( TEMPHUM18_STATUS_VALID_DATA ) - Data that has not been fetched since the last measurement cycle,
  • 0x01 ( TEMPHUM18_STATUS_STALE_DATA ) - Data that has already been fetched since the last measurement cycle.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
Status : If a data fetch is performed before or during the first measurement after power-on reset, then the stale status will be returned, but this data is actually invalid since the first measurement has not been completed. The function performs a delay depending on the selected data resolution:
  • 14-bit resolution it is 33.90 milliseconds,
  • 12-bit resolution it is 9.10 milliseconds,
  • 10-bit resolution it is 2.72 milliseconds,
  • 8-bit resolution it is 1.20 milliseconds.

◆ temphum18_get_temp_hum()

err_t temphum18_get_temp_hum ( temphum18_t * ctx,
uint8_t resolution,
float * temperature,
float * humidity )

Temp&Hum 18 get temperature and humidity function.

This function get temperature ( degree Celsius ) and humidity ( % ) of the HS3003 High Performance Relative Humidity and Temperature Sensor on the Temp&Hum 18 click board™.

Parameters
[in]ctx: Click context object.
[in]resolution:
  • 0x00 ( TEMPHUM18_RESOLUTION_8_BITS ) - 8 bit resolution,
  • 0x01 ( TEMPHUM18_RESOLUTION_10_BITS ) - 10 bit resolution,
  • 0x02 ( TEMPHUM18_RESOLUTION_12_BITS ) - 12 bit resolution,
  • 0x03 ( TEMPHUM18_RESOLUTION_14_BITS ) - 14 bit resolution.
[out]temperature: Temperature data ( degree Celsius ).
[out]humidity: Humidity data ( % ).
Returns
  • 0 ( TEMPHUM18_STATUS_VALID_DATA ) - Data that has not been fetched since the last measurement cycle,
  • 1 ( TEMPHUM18_STATUS_STALE_DATA ) - Data that has already been fetched since the last measurement cycle.
  • -1 - Communication Error.
See #err_t definition for detailed explanation.
Note
Status : If a data fetch is performed before or during the first measurement after power-on reset, then the stale status will be returned, but this data is actually invalid since the first measurement has not been completed. The function performs a delay depending on the selected data resolution:
  • 14-bit resolution it is 33.90 milliseconds,
  • 12-bit resolution it is 9.10 milliseconds,
  • 10-bit resolution it is 2.72 milliseconds,
  • 8-bit resolution it is 1.20 milliseconds.

◆ temphum18_init()

err_t temphum18_init ( temphum18_t * ctx,
temphum18_cfg_t * cfg )

Temp&Hum 18 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See temphum18_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See temphum18_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum18_set_relative_humidity_resolution()

err_t temphum18_set_relative_humidity_resolution ( temphum18_t * ctx,
uint8_t resolution )

Temp&Hum 18 set relative humidity resolution function.

This function sets desired relative humidity resolution of the HS3003 High Performance Relative Humidity and Temperature Sensor on the Temp&Hum 18 click board™.

Parameters
[in]ctx: Click context object.
[in]resolution:
  • 0x00 ( TEMPHUM18_RESOLUTION_8_BITS ) - 8 bit resolution,
  • 0x01 ( TEMPHUM18_RESOLUTION_10_BITS ) - 10 bit resolution,
  • 0x02 ( TEMPHUM18_RESOLUTION_12_BITS ) - 12 bit resolution,
  • 0x03 ( TEMPHUM18_RESOLUTION_14_BITS ) - 14 bit resolution.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The function performs a delay of approximately 14 milliseconds.

◆ temphum18_set_temperature_resolution()

err_t temphum18_set_temperature_resolution ( temphum18_t * ctx,
uint8_t resolution )

Temp&Hum 18 set relative temperature resolution function.

This function sets desired relative temperature resolution of the HS3003 High Performance Relative Humidity and Temperature Sensor on the Temp&Hum 18 click board™.

Parameters
[in]ctx: Click context object.
[in]resolution:
  • 0x00 ( TEMPHUM18_RESOLUTION_8_BITS ) - 8 bit resolution,
  • 0x01 ( TEMPHUM18_RESOLUTION_10_BITS ) - 10 bit resolution,
  • 0x02 ( TEMPHUM18_RESOLUTION_12_BITS ) - 12 bit resolution,
  • 0x03 ( TEMPHUM18_RESOLUTION_14_BITS ) - 14 bit resolution.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The function performs a delay of approximately 14 milliseconds.

◆ temphum18_wake_up()

err_t temphum18_wake_up ( temphum18_t * ctx)

Temp&Hum 18 wake up function.

This function wake up the HS3003 High Performance Relative Humidity and Temperature Sensor from its Sleep Mode.

Parameters
[in]ctx: Click context object. See temphum18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.