temphum20 2.0.0.0
TempHum 20 Click Driver

API for configuring and manipulating TempHum 20 Click driver. More...

Topics

 TempHum 20 Registers List
 List of registers of TempHum 20 Click driver.
 
 TempHum 20 Registers Settings
 Settings for registers of TempHum 20 Click driver.
 
 TempHum 20 MikroBUS Map
 MikroBUS pin mapping of TempHum 20 Click driver.
 

Functions

void temphum20_cfg_setup (temphum20_cfg_t *cfg)
 TempHum 20 configuration object setup function.
 
err_t temphum20_init (temphum20_t *ctx, temphum20_cfg_t *cfg)
 TempHum 20 initialization function.
 
err_t temphum20_default_cfg (temphum20_t *ctx)
 TempHum 20 default configuration function.
 
err_t temphum20_write_data (temphum20_t *ctx, uint8_t *tx_buf, uint8_t tx_len)
 TempHum 20 I2C writing function.
 
err_t temphum20_read_data (temphum20_t *ctx, uint8_t *rx_buf, uint8_t rx_len)
 TempHum 20 I2C reading function.
 
void temphum20_set_en_pin (temphum20_t *ctx, uint8_t state)
 TempHum 20 set EN pin function.
 
uint8_t temphum20_get_int_pin (temphum20_t *ctx)
 TempHum 20 get INT pin function.
 
uint8_t temphum20_get_alarm_high_pin (temphum20_t *ctx)
 TempHum 20 get alarm high pin function.
 
uint8_t temphum20_get_alarm_low_pin (temphum20_t *ctx)
 TempHum 20 get alarm low pin function.
 
void temphum20_reset_device (temphum20_t *ctx)
 TempHum 20 reset device function.
 
err_t temphum20_write_command (temphum20_t *ctx, uint8_t cmd_byte, uint16_t cmd_data)
 TempHum 20 write command function.
 
err_t temphum20_get_measurement (temphum20_t *ctx, float *temp, float *hum)
 TempHum 20 get measurement function.
 
err_t temphum20_set_operating_mode (temphum20_t *ctx, uint8_t op_mode)
 TempHum 20 set operating mode function.
 

Detailed Description

API for configuring and manipulating TempHum 20 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

◆ temphum20_cfg_setup()

void temphum20_cfg_setup ( temphum20_cfg_t * cfg)

TempHum 20 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ temphum20_default_cfg()

err_t temphum20_default_cfg ( temphum20_t * ctx)

TempHum 20 default configuration function.

This function executes a default configuration of TempHum 20 click board.

Parameters
[in]ctx: Click context object. See temphum20_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.

◆ temphum20_get_alarm_high_pin()

uint8_t temphum20_get_alarm_high_pin ( temphum20_t * ctx)

TempHum 20 get alarm high pin function.

This function returns the alarm high (ALH) pin logic state.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ temphum20_get_alarm_low_pin()

uint8_t temphum20_get_alarm_low_pin ( temphum20_t * ctx)

TempHum 20 get alarm low pin function.

This function returns the alarm low (ALL) pin logic state.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ temphum20_get_int_pin()

uint8_t temphum20_get_int_pin ( temphum20_t * ctx)

TempHum 20 get INT pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ temphum20_get_measurement()

err_t temphum20_get_measurement ( temphum20_t * ctx,
float * temp,
float * hum )

TempHum 20 get measurement function.

This function waits for the data to be ready, and then reads the temperature and humidity data and converts them to Celsius and Percents, respectively.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
[out]temp: Temperature data in Celsius.
[out]hum: Humidity data in Percents.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum20_init()

err_t temphum20_init ( temphum20_t * ctx,
temphum20_cfg_t * cfg )

TempHum 20 initialization function.

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

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

◆ temphum20_read_data()

err_t temphum20_read_data ( temphum20_t * ctx,
uint8_t * rx_buf,
uint8_t rx_len )

TempHum 20 I2C reading function.

This function reads a desired number of data bytes by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
[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.

◆ temphum20_reset_device()

void temphum20_reset_device ( temphum20_t * ctx)

TempHum 20 reset device function.

This function resets the device by toggling the EN pin.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ temphum20_set_en_pin()

void temphum20_set_en_pin ( temphum20_t * ctx,
uint8_t state )

TempHum 20 set EN pin function.

This function sets the EN pin to a desired logic state.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ temphum20_set_operating_mode()

err_t temphum20_set_operating_mode ( temphum20_t * ctx,
uint8_t op_mode )

TempHum 20 set operating mode function.

This function sets the device operating mode.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
[in]op_mode:
  • 0 - Command mode,
  • 1 - Normal operating mode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum20_write_command()

err_t temphum20_write_command ( temphum20_t * ctx,
uint8_t cmd_byte,
uint16_t cmd_data )

TempHum 20 write command function.

This function writes a desired command data to the selected command byte.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
[in]cmd_byte: Command byte.
[in]cmd_data: Command data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ temphum20_write_data()

err_t temphum20_write_data ( temphum20_t * ctx,
uint8_t * tx_buf,
uint8_t tx_len )

TempHum 20 I2C writing function.

This function writes a desired number of data bytes by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum20_t object definition for detailed explanation.
[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.