pressure22 2.1.0.0
Pressure 22 Click Driver

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

Topics

 Pressure 22 Commands List
 List of commands of Pressure 22 Click driver.
 
 Pressure 22 Registers Settings
 Settings for registers of Pressure 22 Click driver.
 
 Pressure 22 MikroBUS Map
 MikroBUS pin mapping of Pressure 22 Click driver.
 

Functions

void pressure22_cfg_setup (pressure22_cfg_t *cfg)
 Pressure 22 configuration object setup function.
 
err_t pressure22_init (pressure22_t *ctx, pressure22_cfg_t *cfg)
 Pressure 22 initialization function.
 
err_t pressure22_default_cfg (pressure22_t *ctx)
 Pressure 22 default configuration function.
 
err_t pressure22_generic_write (pressure22_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
 Pressure 22 I2C writing function.
 
err_t pressure22_generic_read (pressure22_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t len)
 Pressure 22 I2C reading function.
 
err_t pressure22_set_command (pressure22_t *ctx, uint8_t cmd)
 Pressure 22 set the command function.
 
err_t pressure22_sw_reset (pressure22_t *ctx)
 Pressure 22 sw reset function.
 
err_t pressure22_get_adc_data (pressure22_t *ctx, uint32_t *adc)
 Pressure 22 gets the ADC data function.
 
err_t pressure22_get_prom_data (pressure22_t *ctx, uint8_t cmd_prom, uint16_t *prom)
 Pressure 22 gets the PROM data function.
 
err_t pressure22_get_calibration_data (pressure22_t *ctx)
 Pressure 22 gets the calibration data function.
 
err_t pressure22_check_data_validity (pressure22_t *ctx)
 Pressure 22 checks data validity function.
 
void pressure22_set_conversion (pressure22_t *ctx, pressure22_press_conv_t press_conv, pressure22_temp_conv_t temp_conv)
 Pressure 22 set conversion function.
 
err_t pressure22_get_measurement_data (pressure22_t *ctx, float *temperature, float *pressure)
 Pressure 22 get the measurement data function.
 

Detailed Description

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

◆ pressure22_cfg_setup()

void pressure22_cfg_setup ( pressure22_cfg_t * cfg)

Pressure 22 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ pressure22_check_data_validity()

err_t pressure22_check_data_validity ( pressure22_t * ctx)

Pressure 22 checks data validity function.

This function checks CRC to check the data validity in memory of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

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

◆ pressure22_default_cfg()

err_t pressure22_default_cfg ( pressure22_t * ctx)

Pressure 22 default configuration function.

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

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

◆ pressure22_generic_read()

err_t pressure22_generic_read ( pressure22_t * ctx,
uint8_t cmd,
uint8_t * data_out,
uint8_t len )

Pressure 22 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See pressure22_t object definition for detailed explanation.
[in]cmd: Command byte.
[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.

◆ pressure22_generic_write()

err_t pressure22_generic_write ( pressure22_t * ctx,
uint8_t cmd,
uint8_t * data_in,
uint8_t len )

Pressure 22 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See pressure22_t object definition for detailed explanation.
[in]cmd: Command byte.
[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.

◆ pressure22_get_adc_data()

err_t pressure22_get_adc_data ( pressure22_t * ctx,
uint32_t * adc )

Pressure 22 gets the ADC data function.

This function reads temperature or pressure ADC data of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

Parameters
[in]ctx: Click context object. See pressure22_t object definition for detailed explanation.
[out]adc: ADC read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure22_get_calibration_data()

err_t pressure22_get_calibration_data ( pressure22_t * ctx)

Pressure 22 gets the calibration data function.

This function reads and store calibration data, factory calibrated from the PROM memory of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

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

◆ pressure22_get_measurement_data()

err_t pressure22_get_measurement_data ( pressure22_t * ctx,
float * temperature,
float * pressure )

Pressure 22 get the measurement data function.

This function reads temperature and pressure data conversion of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

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

◆ pressure22_get_prom_data()

err_t pressure22_get_prom_data ( pressure22_t * ctx,
uint8_t cmd_prom,
uint16_t * prom )

Pressure 22 gets the PROM data function.

This function reads calibration data, factory calibrated from the PROM memory of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

Parameters
[in]ctx: Click context object. See pressure22_t object definition for detailed explanation.
[in]cmd_prom: PROM command.
[out]prom: PROM read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure22_init()

err_t pressure22_init ( pressure22_t * ctx,
pressure22_cfg_t * cfg )

Pressure 22 initialization function.

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

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

◆ pressure22_set_command()

err_t pressure22_set_command ( pressure22_t * ctx,
uint8_t cmd )

Pressure 22 set the command function.

This function writes the desired command of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

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

◆ pressure22_set_conversion()

void pressure22_set_conversion ( pressure22_t * ctx,
pressure22_press_conv_t press_conv,
pressure22_temp_conv_t temp_conv )

Pressure 22 set conversion function.

This function sets the desired temperature and pressure data conversion of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

Parameters
[in]ctx: Click context object. See pressure22_t object definition for detailed explanation.
[in]press_conv: Pressure conversion object. See pressure22_press_conv_t definition for detailed explanation.
[in]temp_conv: Temperature conversion object. See pressure22_temp_conv_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pressure22_sw_reset()

err_t pressure22_sw_reset ( pressure22_t * ctx)

Pressure 22 sw reset function.

This function performs the software reset of the MS5839-02BA, Ultra-compact, chlorine resistant, digital pressure and temperature sensor on the Pressure 22 Click board™.

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