pressure21 2.1.0.0
Pressure 21 Click Driver

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

Topics

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

Functions

void pressure21_cfg_setup (pressure21_cfg_t *cfg)
 Pressure 21 configuration object setup function.
 
void pressure21_drv_interface_selection (pressure21_cfg_t *cfg, pressure21_drv_t drv_sel)
 Pressure 21 driver interface setup function.
 
err_t pressure21_init (pressure21_t *ctx, pressure21_cfg_t *cfg)
 Pressure 21 initialization function.
 
err_t pressure21_default_cfg (pressure21_t *ctx)
 Pressure 21 default configuration function.
 
err_t pressure21_generic_write (pressure21_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Pressure 21 data writing function.
 
err_t pressure21_generic_read (pressure21_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Pressure 21 data reading function.
 
err_t pressure21_write_register (pressure21_t *ctx, uint8_t reg, uint8_t data_in)
 Pressure 21 write register function.
 
err_t pressure21_read_register (pressure21_t *ctx, uint8_t reg, uint8_t *data_out)
 Pressure 21 read register function.
 
err_t pressure21_check_communication (pressure21_t *ctx)
 Pressure 21 check communication function.
 
uint8_t pressure21_get_int_pin (pressure21_t *ctx)
 Pressure 21 get int pin function.
 
err_t pressure21_get_sensor_data (pressure21_t *ctx, float *pressure, float *temperature)
 Pressure 21 get sensor data function.
 

Detailed Description

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

◆ pressure21_cfg_setup()

void pressure21_cfg_setup ( pressure21_cfg_t * cfg)

Pressure 21 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ pressure21_check_communication()

err_t pressure21_check_communication ( pressure21_t * ctx)

Pressure 21 check communication function.

This function checks the communication by reading and verifying the chip ID value.

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

◆ pressure21_default_cfg()

err_t pressure21_default_cfg ( pressure21_t * ctx)

Pressure 21 default configuration function.

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

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

◆ pressure21_drv_interface_selection()

void pressure21_drv_interface_selection ( pressure21_cfg_t * cfg,
pressure21_drv_t drv_sel )

Pressure 21 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 pressure21_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See pressure21_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.

◆ pressure21_generic_read()

err_t pressure21_generic_read ( pressure21_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Pressure 21 data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See pressure21_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure21_generic_write()

err_t pressure21_generic_write ( pressure21_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Pressure 21 data writing function.

This function writes a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See pressure21_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure21_get_int_pin()

uint8_t pressure21_get_int_pin ( pressure21_t * ctx)

Pressure 21 get int pin function.

This function returns the INT pin logic state.

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

◆ pressure21_get_sensor_data()

err_t pressure21_get_sensor_data ( pressure21_t * ctx,
float * pressure,
float * temperature )

Pressure 21 get sensor data function.

This function reads the sensor measurements data: pressure in Pascals and temperature in Celsius.

Parameters
[in]ctx: Click context object. See pressure21_t object definition for detailed explanation.
[out]pressure: Pressure in Pascals.
[out]temperature: Temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure21_init()

err_t pressure21_init ( pressure21_t * ctx,
pressure21_cfg_t * cfg )

Pressure 21 initialization function.

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

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

◆ pressure21_read_register()

err_t pressure21_read_register ( pressure21_t * ctx,
uint8_t reg,
uint8_t * data_out )

Pressure 21 read register function.

This function reads a data byte from the selected register.

Parameters
[in]ctx: Click context object. See pressure21_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure21_write_register()

err_t pressure21_write_register ( pressure21_t * ctx,
uint8_t reg,
uint8_t data_in )

Pressure 21 write register function.

This function writes a desired data to the selected register.

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