pressure22 2.1.0.0
pressure22.h File Reference

This file contains API for Pressure 22 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  pressure22_t
 Pressure 22 Click context object. More...
 
struct  pressure22_cfg_t
 Pressure 22 Click configuration object. More...
 

Macros

#define PRESSURE22_CMD_ADC_READ   0x00
 Pressure 22 description command.
 
#define PRESSURE22_CMD_RESET   0x1E
 
#define PRESSURE22_CMD_PROM_VERSION   0xA0
 
#define PRESSURE22_CMD_PROM_READ_C1   0xA2
 
#define PRESSURE22_CMD_PROM_READ_C2   0xA4
 
#define PRESSURE22_CMD_PROM_READ_C3   0xA6
 
#define PRESSURE22_CMD_PROM_READ_C4   0xA8
 
#define PRESSURE22_CMD_PROM_READ_C5   0xAA
 
#define PRESSURE22_CMD_PROM_READ_C6   0xAC
 
#define PRESSURE22_CMD_PROM_END   0xAE
 
#define PRESSURE22_CRC4_BIT_MASK   0x000Fu
 Pressure 22 bit mask.
 
#define PRESSURE22_VER_DEF_BIT_MASK   0x007Fu
 
#define PRESSURE22_FCT_DEF_BIT_MASK   0x001Fu
 
#define PRESSURE22_TEMPERATURE_20_C   40.0f
 Pressure 22 calculation coefficients.
 
#define PRESSURE22_TEMPERATURE_10_C   10.0f
 
#define PRESSURE22_TEMP_TYPICAL   2000.0f
 
#define PRESSURE22_TEMP_DIV   100.0f
 
#define PRESSURE22_OFF_ACT_TEMP_MULTP   131072.0f
 
#define PRESSURE22_OFF_ACT_TEMP_DIV   64.0f
 
#define PRESSURE22_SENS_ACT_TEMP_MULTP   65536.0f
 
#define PRESSURE22_SENS_ACT_TEMP_DIV   128.0f
 
#define PRESSURE22_TEMP_COMP_PRESS_DIV   2097152.0f
 
#define PRESSURE22_COMP_PRESS_DIV   32768.0f
 
#define PRESSURE22_PRESS_CONVERT_PA_MBAR   100.0f
 
#define PRESSURE22_SEC_COMP_TI_DIV   34359738368.0f
 
#define PRESSURE22_SEC_COMP_TI_1_MULTP   14.0f
 
#define PRESSURE22_SEC_COMP_OFFI_1_MULTP   35.0f
 
#define PRESSURE22_SEC_COMP_SENS_MULTP   63.0f
 
#define PRESSURE22_SEC_COMP_OFFI_1_DIV   8.0f
 
#define PRESSURE22_SEC_COMP_TI_2_MULTP   12.0f
 
#define PRESSURE22_SEC_COMP_OFFI_2_MULTP   30.0f
 
#define PRESSURE22_SEC_COMP_OFFI_2_DIV   256.0f
 
#define PRESSURE22_SEC_COMP_SENSI_DIV   32.0f
 
#define PRESSURE22_DEVICE_ADDRESS   0x76
 Pressure 22 device address setting.
 
#define PRESSURE22_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  pressure22_press_conv_t {
  PRESSURE22_CMD_PRESS_OSR_256 = 0x40 , PRESSURE22_CMD_PRESS_OSR_512 = 0x42 , PRESSURE22_CMD_PRESS_OSR_1024 = 0x44 , PRESSURE22_CMD_PRESS_OSR_2048 = 0x46 ,
  PRESSURE22_CMD_PRESS_OSR_4096 = 0x48 , PRESSURE22_CMD_PRESS_OSR_8192 = 0x4A
}
 Pressure 22 Click pressure conversion value data. More...
 
enum  pressure22_temp_conv_t {
  PRESSURE22_CMD_TEMP_OSR_256 = 0x50 , PRESSURE22_CMD_TEMP_OSR_512 = 0x52 , PRESSURE22_CMD_TEMP_OSR_1024 = 0x54 , PRESSURE22_CMD_TEMP_OSR_2048 = 0x56 ,
  PRESSURE22_CMD_TEMP_OSR_4096 = 0x58 , PRESSURE22_CMD_TEMP_OSR_8192 = 0x5A
}
 Pressure 22 Click temperature conversion value data. More...
 
enum  pressure22_return_value_t { PRESSURE22_OK = 0 , PRESSURE22_ERROR = -1 }
 Pressure 22 Click return value data. More...
 

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

This file contains API for Pressure 22 Click Driver.

Enumeration Type Documentation

◆ pressure22_press_conv_t

Pressure 22 Click pressure conversion value data.

Predefined enum values for pressure conversion values.

Enumerator
PRESSURE22_CMD_PRESS_OSR_256 
PRESSURE22_CMD_PRESS_OSR_512 
PRESSURE22_CMD_PRESS_OSR_1024 
PRESSURE22_CMD_PRESS_OSR_2048 
PRESSURE22_CMD_PRESS_OSR_4096 
PRESSURE22_CMD_PRESS_OSR_8192 

◆ pressure22_return_value_t

Pressure 22 Click return value data.

Predefined enum values for driver return values.

Enumerator
PRESSURE22_OK 
PRESSURE22_ERROR 

◆ pressure22_temp_conv_t

Pressure 22 Click temperature conversion value data.

Predefined enum values for temperature conversion values.

Enumerator
PRESSURE22_CMD_TEMP_OSR_256 
PRESSURE22_CMD_TEMP_OSR_512 
PRESSURE22_CMD_TEMP_OSR_1024 
PRESSURE22_CMD_TEMP_OSR_2048 
PRESSURE22_CMD_TEMP_OSR_4096 
PRESSURE22_CMD_TEMP_OSR_8192