temphum21 2.0.0.0
TempHum 21 Click Driver

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

Topics

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

Functions

void temphum21_cfg_setup (temphum21_cfg_t *cfg)
 TempHum 21 configuration object setup function.
 
err_t temphum21_init (temphum21_t *ctx, temphum21_cfg_t *cfg)
 TempHum 21 initialization function.
 
err_t temphum21_default_cfg (temphum21_t *ctx)
 TempHum 21 default configuration function.
 
err_t temphum21_request_measurement (temphum21_t *ctx)
 TempHum 21 request measurement function.
 
err_t temphum21_read_measurement (temphum21_t *ctx, float *temperature, float *humidity)
 TempHum 21 read measurement function.
 
uint8_t temphum21_get_all_pin (temphum21_t *ctx)
 TempHum 21 get all pin function.
 
uint8_t temphum21_get_alh_pin (temphum21_t *ctx)
 TempHum 21 get alh pin function.
 
void temphum21_enable_device (temphum21_t *ctx)
 TempHum 21 enable device function.
 
void temphum21_disable_device (temphum21_t *ctx)
 TempHum 21 disable device function.
 
err_t temphum21_enter_command_mode (temphum21_t *ctx)
 TempHum 21 enter command mode function.
 
err_t temphum21_exit_command_mode (temphum21_t *ctx)
 TempHum 21 exit command mode function.
 
err_t temphum21_eeprom_read (temphum21_t *ctx, uint8_t address, uint8_t *status, uint16_t *data_out)
 TempHum 21 eeprom read function.
 
err_t temphum21_eeprom_write (temphum21_t *ctx, uint8_t address, uint16_t data_in)
 TempHum 21 eeprom write function.
 

Detailed Description

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

◆ temphum21_cfg_setup()

void temphum21_cfg_setup ( temphum21_cfg_t * cfg)

TempHum 21 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ temphum21_default_cfg()

err_t temphum21_default_cfg ( temphum21_t * ctx)

TempHum 21 default configuration function.

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

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

◆ temphum21_disable_device()

void temphum21_disable_device ( temphum21_t * ctx)

TempHum 21 disable device function.

This function disables the device by setting the EN pin to LOW logic state.

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

◆ temphum21_eeprom_read()

err_t temphum21_eeprom_read ( temphum21_t * ctx,
uint8_t address,
uint8_t * status,
uint16_t * data_out )

TempHum 21 eeprom read function.

This function reads data from a desired eeprom address.

Parameters
[in]ctx: Click context object. See temphum21_t object definition for detailed explanation.
[in]address: Address to read data from.
[out]status: Status byte read (Status-Diagnostic-Response bits: SS-DDDD-RR).
[out]data_out: Output data read.
Returns
  • 0 - Success.
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum21_eeprom_write()

err_t temphum21_eeprom_write ( temphum21_t * ctx,
uint8_t address,
uint16_t data_in )

TempHum 21 eeprom write function.

This function writes data to a desired eeprom address.

Parameters
[in]ctx: Click context object. See temphum21_t object definition for detailed explanation.
[in]address: Address to write data to.
[in]data_in: Data to be written.
Returns
  • 0 - Success.
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum21_enable_device()

void temphum21_enable_device ( temphum21_t * ctx)

TempHum 21 enable device function.

This function enables the device by setting the EN pin to HIGH logic state.

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

◆ temphum21_enter_command_mode()

err_t temphum21_enter_command_mode ( temphum21_t * ctx)

TempHum 21 enter command mode function.

This function enters the command mode.

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

◆ temphum21_exit_command_mode()

err_t temphum21_exit_command_mode ( temphum21_t * ctx)

TempHum 21 exit command mode function.

This function exits the command mode and enters the normal operating mode.

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

◆ temphum21_get_alh_pin()

uint8_t temphum21_get_alh_pin ( temphum21_t * ctx)

TempHum 21 get alh pin function.

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

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

◆ temphum21_get_all_pin()

uint8_t temphum21_get_all_pin ( temphum21_t * ctx)

TempHum 21 get all pin function.

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

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

◆ temphum21_init()

err_t temphum21_init ( temphum21_t * ctx,
temphum21_cfg_t * cfg )

TempHum 21 initialization function.

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

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

◆ temphum21_read_measurement()

err_t temphum21_read_measurement ( temphum21_t * ctx,
float * temperature,
float * humidity )

TempHum 21 read measurement function.

This function requests measurement and waits for a measurement to complete and after that reads temperature in Celsius and relative humidity in percents.

Parameters
[in]ctx: Click context object. See temphum21_t object definition for detailed explanation.
[out]temperature: Temperature in Celsius.
[out]humidity: Relative humidity in Percents.
Returns
  • 0x80 - Device in Command Mode - Command Mode is used for programming the sensor.
  • 0x40 - Stale Data: Data that has already been fetched since the last measurement cycle, or data fetched before the first measurement has been completed.
  • 0x00 - Normal Operation, Valid Data that has not been fetched since the last measurement cycle.
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum21_request_measurement()

err_t temphum21_request_measurement ( temphum21_t * ctx)

TempHum 21 request measurement function.

This function sends a request mesurement command.

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