temphum27 2.2.0
Loading...
Searching...
No Matches
TempHum 27 Click Driver

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

Topics

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

Functions

void temphum27_cfg_setup (temphum27_cfg_t *cfg)
 TempHum 27 configuration object setup function.
err_t temphum27_init (temphum27_t *ctx, temphum27_cfg_t *cfg)
 TempHum 27 initialization function.
err_t temphum27_write_reg (temphum27_t *ctx, uint8_t reg, uint8_t data_in)
 TempHum 27 write register function.
err_t temphum27_read_reg (temphum27_t *ctx, uint8_t reg, uint8_t *data_out)
 TempHum 27 read register function.
err_t temphum27_read_data_hold (temphum27_t *ctx, float *temp, float *hum)
 TempHum 27 read data (hold mode) function.
err_t temphum27_read_data_no_hold (temphum27_t *ctx, float *temp, float *hum)
 TempHum 27 read data (no hold mode) function.
err_t temphum27_start_periodic_meas (temphum27_t *ctx, uint8_t freq)
 TempHum 27 start periodic measurement function.
err_t temphum27_stop_periodic_meas (temphum27_t *ctx)
 TempHum 27 stop periodic measurement function.
err_t temphum27_read_data_periodic (temphum27_t *ctx, float *temp, float *hum)
 TempHum 27 read data in periodic mode function.
err_t temphum27_read_data_periodic_al (temphum27_t *ctx, float *temp, float *hum, uint8_t *alert)
 TempHum 27 read data and alert in periodic mode function.
err_t temphum27_read_sensor_id (temphum27_t *ctx, uint32_t *sensor_id)
 TempHum 27 read sensor ID function.
void temphum27_enable_device (temphum27_t *ctx)
 TempHum 27 enable device function.
void temphum27_disable_device (temphum27_t *ctx)
 TempHum 27 disable device function.
void temphum27_reset_device (temphum27_t *ctx)
 TempHum 27 reset device function.
uint8_t temphum27_get_alert_pin (temphum27_t *ctx)
 TempHum 27 get alert pin function.

Detailed Description

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

◆ temphum27_cfg_setup()

void temphum27_cfg_setup ( temphum27_cfg_t * cfg)

TempHum 27 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ temphum27_disable_device()

void temphum27_disable_device ( temphum27_t * ctx)

TempHum 27 disable device function.

This function sets the EN pin to low logic level to disable the device.

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

◆ temphum27_enable_device()

void temphum27_enable_device ( temphum27_t * ctx)

TempHum 27 enable device function.

This function sets the EN pin to high logic level to enable the device.

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

◆ temphum27_get_alert_pin()

uint8_t temphum27_get_alert_pin ( temphum27_t * ctx)

TempHum 27 get alert pin function.

This function reads the logic level of the ALR (alert) pin.

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

◆ temphum27_init()

err_t temphum27_init ( temphum27_t * ctx,
temphum27_cfg_t * cfg )

TempHum 27 initialization function.

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

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

◆ temphum27_read_data_hold()

err_t temphum27_read_data_hold ( temphum27_t * ctx,
float * temp,
float * hum )

TempHum 27 read data (hold mode) function.

This function reads temperature and/or humidity in hold mode and converts to physical values.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[out]temp: Pointer to temperature in Celsius.
[out]hum: Pointer to relative humidity in percentage.
Returns
  • 0 - Success,
  • -1 - Error.
Note
At least one output pointer (temp or hum) must be non-NULL.

◆ temphum27_read_data_no_hold()

err_t temphum27_read_data_no_hold ( temphum27_t * ctx,
float * temp,
float * hum )

TempHum 27 read data (no hold mode) function.

This function performs a no-hold measurement and reads temperature and/or humidity.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[out]temp: Pointer to temperature in Celsius.
[out]hum: Pointer to relative humidity in percentage.
Returns
  • 0 - Success,
  • -1 - Error.
Note
At least one output pointer (temp or hum) must be non-NULL.

◆ temphum27_read_data_periodic()

err_t temphum27_read_data_periodic ( temphum27_t * ctx,
float * temp,
float * hum )

TempHum 27 read data in periodic mode function.

This function reads temperature and/or humidity data in periodic measurement mode.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[out]temp: Pointer to temperature in Celsius.
[out]hum: Pointer to relative humidity in percentage.
Returns
  • 0 - Success,
  • -1 - Error.
Note
At least one output pointer (temp or hum) must be non-NULL, and alert feature must be disabled (default state).

◆ temphum27_read_data_periodic_al()

err_t temphum27_read_data_periodic_al ( temphum27_t * ctx,
float * temp,
float * hum,
uint8_t * alert )

TempHum 27 read data and alert in periodic mode function.

This function reads temperature, humidity, and alert status during periodic measurements.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[out]temp: Pointer to temperature in Celsius.
[out]hum: Pointer to relative humidity in percentage.
[out]alert: Pointer to alert flag byte.
Returns
  • 0 - Success,
  • -1 - Error.
Note
At least one output pointer (temp, hum, or alert) must be non-NULL, and alert feature must be enabled.

◆ temphum27_read_reg()

err_t temphum27_read_reg ( temphum27_t * ctx,
uint8_t reg,
uint8_t * data_out )

TempHum 27 read register function.

This function reads a byte of data from the selected register using I2C communication.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to memory where the read byte will be stored.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ temphum27_read_sensor_id()

err_t temphum27_read_sensor_id ( temphum27_t * ctx,
uint32_t * sensor_id )

TempHum 27 read sensor ID function.

This function reads the unique 32-bit sensor ID.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[out]sensor_id: Pointer to memory where sensor ID will be stored.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ temphum27_reset_device()

void temphum27_reset_device ( temphum27_t * ctx)

TempHum 27 reset device function.

This function performs a hardware reset by toggling the EN pin.

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

◆ temphum27_start_periodic_meas()

err_t temphum27_start_periodic_meas ( temphum27_t * ctx,
uint8_t freq )

TempHum 27 start periodic measurement function.

This function configures and starts periodic measurement mode at the specified frequency.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[in]freq: Measurement frequency.
  • 0 - 0.5 seconds,
  • 1 - 1 second.
  • 2 - 2.5 seconds.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ temphum27_stop_periodic_meas()

err_t temphum27_stop_periodic_meas ( temphum27_t * ctx)

TempHum 27 stop periodic measurement function.

This function stops any ongoing periodic measurement.

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

◆ temphum27_write_reg()

err_t temphum27_write_reg ( temphum27_t * ctx,
uint8_t reg,
uint8_t data_in )

TempHum 27 write register function.

This function writes a data byte to the selected register using I2C communication.

Parameters
[in]ctx: Click context object. See temphum27_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data byte to be written.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.