temphum24 2.1.0.0
TempHum 24 Click Driver

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

Topics

 TempHum 24 Commands List
 List of commands of TempHum 24 Click driver.
 
 TempHum 24 Registers Settings
 Settings for registers of TempHum 24 Click driver.
 
 TempHum 24 MikroBUS Map
 MikroBUS pin mapping of TempHum 24 Click driver.
 

Functions

void temphum24_cfg_setup (temphum24_cfg_t *cfg)
 TempHum 24 configuration object setup function.
 
err_t temphum24_init (temphum24_t *ctx, temphum24_cfg_t *cfg)
 TempHum 24 initialization function.
 
err_t temphum24_default_cfg (temphum24_t *ctx)
 TempHum 24 default configuration function.
 
err_t temphum24_write_cmd (temphum24_t *ctx, uint16_t cmd)
 TempHum 24 write cmd function.
 
err_t temphum24_write_cmd_config (temphum24_t *ctx, uint16_t cmd, uint16_t config)
 TempHum 24 write cmd config function.
 
err_t temphum24_read_single (temphum24_t *ctx, uint16_t *data_out)
 TempHum 24 read single function.
 
err_t temphum24_read_multi (temphum24_t *ctx, uint16_t *data1_out, uint16_t *data2_out)
 TempHum 24 read multi function.
 
err_t temphum24_write_then_read_single (temphum24_t *ctx, uint16_t cmd, uint16_t *data_out)
 TempHum 24 write then read single function.
 
err_t temphum24_write_then_read_multi (temphum24_t *ctx, uint16_t cmd, uint16_t *data1_out, uint16_t *data2_out)
 TempHum 24 write then read multi function.
 
void temphum24_enable_device (temphum24_t *ctx)
 TempHum 24 enable device function.
 
void temphum24_disable_device (temphum24_t *ctx)
 TempHum 24 disable device function.
 
void temphum24_reset_device (temphum24_t *ctx)
 TempHum 24 reset device function.
 
uint8_t temphum24_get_alert_pin (temphum24_t *ctx)
 TempHum 24 get alert pin function.
 
err_t temphum24_check_communication (temphum24_t *ctx)
 TempHum 24 check communication function.
 
err_t temphum24_read_temp_and_rh (temphum24_t *ctx, float *temp, float *hum)
 TempHum 24 read temp and rh function.
 
err_t temphum24_read_temp_history (temphum24_t *ctx, float *temp_min, float *temp_max)
 TempHum 24 read temp history function.
 
err_t temphum24_read_rh_history (temphum24_t *ctx, float *hum_min, float *hum_max)
 TempHum 24 read rh history function.
 
err_t temphum24_start_measurement (temphum24_t *ctx)
 TempHum 24 start measurement function.
 
err_t temphum24_stop_measurement (temphum24_t *ctx)
 TempHum 24 stop measurement function.
 
err_t temphum24_get_serial_number (temphum24_t *ctx, uint16_t *serial_number)
 TempHum 24 read serial number function.
 

Detailed Description

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

◆ temphum24_cfg_setup()

void temphum24_cfg_setup ( temphum24_cfg_t * cfg)

TempHum 24 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ temphum24_check_communication()

err_t temphum24_check_communication ( temphum24_t * ctx)

TempHum 24 check communication function.

This function checks the communication by reading and verifying the manufacturer ID.

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

◆ temphum24_default_cfg()

err_t temphum24_default_cfg ( temphum24_t * ctx)

TempHum 24 default configuration function.

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

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

◆ temphum24_disable_device()

void temphum24_disable_device ( temphum24_t * ctx)

TempHum 24 disable device function.

This function disables device by setting the rst pin to low logic state.

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

◆ temphum24_enable_device()

void temphum24_enable_device ( temphum24_t * ctx)

TempHum 24 enable device function.

This function enables device by setting the rst pin to low logic state.

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

◆ temphum24_get_alert_pin()

uint8_t temphum24_get_alert_pin ( temphum24_t * ctx)

TempHum 24 get alert pin function.

This function returns the alert pin logic state.

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

◆ temphum24_get_serial_number()

err_t temphum24_get_serial_number ( temphum24_t * ctx,
uint16_t * serial_number )

TempHum 24 read serial number function.

This function reads the serial number/NIST ID.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[out]serial_number: Pointer to the memory location where serial number value be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum24_init()

err_t temphum24_init ( temphum24_t * ctx,
temphum24_cfg_t * cfg )

TempHum 24 initialization function.

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

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

◆ temphum24_read_multi()

err_t temphum24_read_multi ( temphum24_t * ctx,
uint16_t * data1_out,
uint16_t * data2_out )

TempHum 24 read multi function.

This function reads two data words from the device by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[out]data1_out: Output read word data 1.
[out]data2_out: Output read word data 2.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function must follow the write command sequence that initiates the data acquisition.

◆ temphum24_read_rh_history()

err_t temphum24_read_rh_history ( temphum24_t * ctx,
float * hum_min,
float * hum_max )

TempHum 24 read rh history function.

This function reads the relative humidity minimum and maximum values since the beginning of measurements.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[out]hum_min: Minimum relative humidity level in percents.
[out]hum_max: Maximum relative humidity level in percents.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The device must be set in auto measurements mode. For that you can call the temphum24_start_measurement function.

◆ temphum24_read_single()

err_t temphum24_read_single ( temphum24_t * ctx,
uint16_t * data_out )

TempHum 24 read single function.

This function reads a single data word from the device by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[out]data_out: Output read word data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function must follow the write command sequence that initiates the data acquisition.

◆ temphum24_read_temp_and_rh()

err_t temphum24_read_temp_and_rh ( temphum24_t * ctx,
float * temp,
float * hum )

TempHum 24 read temp and rh function.

This function reads the temperature in celsius and the relative humidity level in percents.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[out]temp: Temperature measurements in celsius.
[out]hum: Humidity measurements in percents.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The device must be set in auto measurements mode. For that you can call the temphum24_start_measurement function.

◆ temphum24_read_temp_history()

err_t temphum24_read_temp_history ( temphum24_t * ctx,
float * temp_min,
float * temp_max )

TempHum 24 read temp history function.

This function reads the temperature minimum and maximum values since the beginning of measurements.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[out]temp_min: Minimum temperature value in celsius.
[out]temp_max: Maximum temperature value in celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The device must be set in auto measurements mode. For that you can call the temphum24_start_measurement function.

◆ temphum24_reset_device()

void temphum24_reset_device ( temphum24_t * ctx)

TempHum 24 reset device function.

This function resets device by toggling the rst pin state.

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

◆ temphum24_start_measurement()

err_t temphum24_start_measurement ( temphum24_t * ctx)

TempHum 24 start measurement function.

This function starts the auto measurement with 1 Hz rate and default low power mode.

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

◆ temphum24_stop_measurement()

err_t temphum24_stop_measurement ( temphum24_t * ctx)

TempHum 24 stop measurement function.

This function exits the auto measurement mode and returns to sleep mode.

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

◆ temphum24_write_cmd()

err_t temphum24_write_cmd ( temphum24_t * ctx,
uint16_t cmd )

TempHum 24 write cmd function.

This function writes the selected command word by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[in]cmd: Command word to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum24_write_cmd_config()

err_t temphum24_write_cmd_config ( temphum24_t * ctx,
uint16_t cmd,
uint16_t config )

TempHum 24 write cmd config function.

This function writes a desired config to the selected command word by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[in]cmd: Command word to configure.
[in]config: Command config to be set.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum24_write_then_read_multi()

err_t temphum24_write_then_read_multi ( temphum24_t * ctx,
uint16_t cmd,
uint16_t * data1_out,
uint16_t * data2_out )

TempHum 24 write then read multi function.

This function writes command word then reads two data words from the device by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[in]cmd: Command word to be written.
[out]data1_out: Output read word data 1.
[out]data2_out: Output read word data 2.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ temphum24_write_then_read_single()

err_t temphum24_write_then_read_single ( temphum24_t * ctx,
uint16_t cmd,
uint16_t * data_out )

TempHum 24 write then read single function.

This function write command word then reads a single data word from the device by using I2C serial interface.

Parameters
[in]ctx: Click context object. See temphum24_t object definition for detailed explanation.
[in]cmd: Command word to be written.
[out]data_out: Output read word data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function must follow the write command sequence that initiates the data acquisition.