humidity 2.0.0.0
Humidity Click Driver

API for configuring and manipulating Humidity Click driver. More...

Topics

 Humidity Settings
 Settings for Humidity Click driver.
 
 Humidity MikroBUS Map
 MikroBUS pin mapping of Humidity Click driver.
 

Functions

void humidity_cfg_setup (humidity_cfg_t *cfg)
 Humidity configuration object setup function.
 
void humidity_drv_interface_selection (humidity_cfg_t *cfg, humidity_drv_t drv_sel)
 Humidity driver interface setup function.
 
err_t humidity_init (humidity_t *ctx, humidity_cfg_t *cfg)
 Humidity initialization function.
 
err_t humidity_read_raw_adc (humidity_t *ctx, uint16_t *raw_adc)
 Humidity read raw ADC value function.
 
err_t humidity_read_voltage (humidity_t *ctx, float *voltage)
 Humidity read voltage level function.
 
err_t humidity_set_vref (humidity_t *ctx, float vref)
 Humidity set vref function.
 
float humidity_voltage_to_rh (humidity_t *ctx, float voltage)
 Humidity voltage to relative humidity function.
 

Detailed Description

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

◆ humidity_cfg_setup()

void humidity_cfg_setup ( humidity_cfg_t * cfg)

Humidity configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ humidity_drv_interface_selection()

void humidity_drv_interface_selection ( humidity_cfg_t * cfg,
humidity_drv_t drv_sel )

Humidity driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See humidity_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See humidity_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ humidity_init()

err_t humidity_init ( humidity_t * ctx,
humidity_cfg_t * cfg )

Humidity initialization function.

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

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

◆ humidity_read_raw_adc()

err_t humidity_read_raw_adc ( humidity_t * ctx,
uint16_t * raw_adc )

Humidity read raw ADC value function.

This function reads raw ADC value.

Parameters
[in]ctx: Click context object. See humidity_t object definition for detailed explanation.
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ humidity_read_voltage()

err_t humidity_read_voltage ( humidity_t * ctx,
float * voltage )

Humidity read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See humidity_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ humidity_set_vref()

err_t humidity_set_vref ( humidity_t * ctx,
float vref )

Humidity set vref function.

This function sets the voltage reference for Humidity click driver.

Parameters
[in]ctx: Click context object. See humidity_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The default voltage reference set with humidity_init is 3.3V.

◆ humidity_voltage_to_rh()

float humidity_voltage_to_rh ( humidity_t * ctx,
float voltage )

Humidity voltage to relative humidity function.

This function calculates relative humidity percents based on the voltage input.

Parameters
[in]ctx: Click context object. See humidity_t object definition for detailed explanation.
[in]voltage: Voltage from OUT (volts).
Returns
Relative humidity percents.
Note
None.