pressure20 2.0.0.0
pressure20.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  pressure20_s
 Pressure 20 Click context object. More...
 
struct  pressure20_cfg_t
 Pressure 20 Click configuration object. More...
 

Macros

#define PRESSURE20_REG_TRIM1_MSB   0x05
 Pressure 20 register map.
 
#define PRESSURE20_REG_TRIM2_LSB   0x06
 
#define PRESSURE20_REG_TRIM2_MSB   0x07
 
#define PRESSURE20_REG_DEVICE_ID   0x0C
 
#define PRESSURE20_REG_IO_DRIVE_STRENGTH   0x0D
 
#define PRESSURE20_REG_OTP_CONFIG1   0xAC
 
#define PRESSURE20_REG_OTP_MR_LSB   0xAD
 
#define PRESSURE20_REG_OTP_MR_MSB   0xAE
 
#define PRESSURE20_REG_OTP_MRA_LSB   0xAF
 
#define PRESSURE20_REG_OTP_MRA_MSB   0xB0
 
#define PRESSURE20_REG_OTP_MRB_LSB   0xB1
 
#define PRESSURE20_REG_OTP_MRB_MSB   0xB2
 
#define PRESSURE20_REG_OTP_ADDRESS_REG   0xB5
 
#define PRESSURE20_REG_OTP_COMMAND_REG   0xB6
 
#define PRESSURE20_REG_OTP_RDATA   0xB8
 
#define PRESSURE20_REG_OTP_STATUS   0xB9
 
#define PRESSURE20_REG_OTP_DBG2   0xBC
 
#define PRESSURE20_REG_MASTER_LOCK   0xBE
 
#define PRESSURE20_REG_OTP_STATUS2   0xBF
 
#define PRESSURE20_REG_MODE_SELECT   0xC0
 
#define PRESSURE20_REG_INTERRUPT_STATUS   0xC1
 
#define PRESSURE20_REG_INTERRUPT_MASK   0xC2
 
#define PRESSURE20_REG_FIFO_CONFIG   0xC3
 
#define PRESSURE20_REG_FIFO_FILL   0xC4
 
#define PRESSURE20_REG_SPI_MODE   0xC5
 
#define PRESSURE20_REG_PRESS_ABS_LSB   0xC7
 
#define PRESSURE20_REG_PRESS_ABS_MSB   0xC8
 
#define PRESSURE20_REG_PRESS_DELTA_LSB   0xC9
 
#define PRESSURE20_REG_PRESS_DELTA_MSB   0xCA
 
#define PRESSURE20_REG_DEVICE_STATUS   0xCD
 
#define PRESSURE20_REG_I3C_INFO   0xCE
 
#define PRESSURE20_REG_VERSION   0xD3
 
#define PRESSURE20_REG_DUMMY   0xEE
 
#define PRESSURE20_REG_PRESS_DATA_0   0xFA
 
#define PRESSURE20_REG_PRESS_DATA_1   0xFB
 
#define PRESSURE20_REG_PRESS_DATA_2   0xFC
 
#define PRESSURE20_REG_TEMP_DATA_0   0xFD
 
#define PRESSURE20_REG_TEMP_DATA_1   0xFE
 
#define PRESSURE20_REG_TEMP_DATA_2   0xFF
 
#define PRESSURE20_TRIM1_MSB_PEFE_OFFSET_MASK   0x3F
 Pressure 20 TRIM settings.
 
#define PRESSURE20_TRIM2_LSB_HFOSC_MASK   0x7F
 
#define PRESSURE20_TRIM2_MSB_PEFE_GAIN_MASK   0x70
 
#define PRESSURE20_TRIM2_MSB_BG_PTAT_MASK   0x0F
 
#define PRESSURE20_OTP_ADDRESS_OFFSET   0xF8
 Pressure 20 OTP address and command settings.
 
#define PRESSURE20_OTP_ADDRESS_GAIN   0xF9
 
#define PRESSURE20_OTP_ADDRESS_HFOSC   0xFA
 
#define PRESSURE20_OTP_COMMAND_READ_ACTION   0x10
 
#define PRESSURE20_OTP_MRA_LSB   0x04
 Pressure 20 OTP settings.
 
#define PRESSURE20_OTP_MRA_MSB   0x04
 
#define PRESSURE20_OTP_MRB_LSB   0x21
 
#define PRESSURE20_OTP_MRB_MSB   0x20
 
#define PRESSURE20_OTP_MR_LSB   0x10
 
#define PRESSURE20_OTP_MR_MSB   0x80
 
#define PRESSURE20_OTP_WRITE_SWITCH   0x02
 Pressure 20 OTP_CONFIG1 register settings.
 
#define PRESSURE20_OTP_ENABLE   0x01
 
#define PRESSURE20_OTP_DISABLE   0x00
 
#define PRESSURE20_OTP_RESET_SET   0x80
 Pressure 20 OTP_DBG2 register settings.
 
#define PRESSURE20_OTP_RESET_CLEAR   0x00
 
#define PRESSURE20_BUSY   0x01
 Pressure 20 OTP_STATUS register settings.
 
#define PRESSURE20_BOOT_UP_STATUS   0x01
 Pressure 20 OTP_STATUS2 register settings.
 
#define PRESSURE20_MASTER_LOCK   0x00
 Pressure 20 MASTER_LOCK register settings.
 
#define PRESSURE20_MASTER_UNLOCK   0x1F
 
#define PRESSURE20_MEAS_CONFIG_MODE0_ODR_25HZ   0x00
 Pressure 20 MODE_SELECT register settings.
 
#define PRESSURE20_MEAS_CONFIG_MODE1_ODR_120HZ   0x20
 
#define PRESSURE20_MEAS_CONFIG_MODE2_ODR_40HZ   0x40
 
#define PRESSURE20_MEAS_CONFIG_MODE3_ODR_2HZ   0x60
 
#define PRESSURE20_MEAS_CONFIG_MODE4   0x80
 
#define PRESSURE20_FORCED_MEAS_TRIGGER   0x10
 
#define PRESSURE20_MEAS_MODE_TRIGGER   0x00
 
#define PRESSURE20_MEAS_MODE_CONTINUOUS   0x08
 
#define PRESSURE20_POWER_MODE_NORMAL   0x00
 
#define PRESSURE20_POWER_MODE_ACTIVE   0x04
 
#define PRESSURE20_FIFO_READOUT_MODE_PRESS_1ST   0x00
 
#define PRESSURE20_FIFO_READOUT_MODE_TEMP_ONLY   0x01
 
#define PRESSURE20_FIFO_READOUT_MODE_TEMP_1ST   0x02
 
#define PRESSURE20_FIFO_READOUT_MODE_PRESS_ONLY   0x03
 
#define PRESSURE20_MODE_SYNC_STATUS   0x01
 Pressure 20 DEVICE_STATUS register settings.
 
#define PRESSURE20_FIFO_FLUSH   0x80
 Pressure 20 FIFO_FILL register settings.
 
#define PRESSURE20_FIFO_EMPTY   0x40
 
#define PRESSURE20_FIFO_FULL   0x20
 
#define PRESSURE20_FIFO_LEVEL_EMPTY   0x00
 
#define PRESSURE20_FIFO_LEVEL_1   0x01
 
#define PRESSURE20_FIFO_LEVEL_2   0x02
 
#define PRESSURE20_FIFO_LEVEL_3   0x03
 
#define PRESSURE20_FIFO_LEVEL_4   0x04
 
#define PRESSURE20_FIFO_LEVEL_5   0x05
 
#define PRESSURE20_FIFO_LEVEL_6   0x06
 
#define PRESSURE20_FIFO_LEVEL_7   0x07
 
#define PRESSURE20_FIFO_LEVEL_8   0x08
 
#define PRESSURE20_FIFO_LEVEL_9   0x09
 
#define PRESSURE20_FIFO_LEVEL_10   0x0A
 
#define PRESSURE20_FIFO_LEVEL_11   0x0B
 
#define PRESSURE20_FIFO_LEVEL_12   0x0C
 
#define PRESSURE20_FIFO_LEVEL_13   0x0D
 
#define PRESSURE20_FIFO_LEVEL_14   0x0E
 
#define PRESSURE20_FIFO_LEVEL_15   0x0F
 
#define PRESSURE20_FIFO_LEVEL_FULL   0x10
 
#define PRESSURE20_INT_STAT_PRESS_DELTA   0x40
 Pressure 20 INTERRUPT_STATUS register settings.
 
#define PRESSURE20_INT_STAT_PRESS_ABS   0x20
 
#define PRESSURE20_INT_STAT_FIFO_WMK_LOW   0x08
 
#define PRESSURE20_INT_STAT_FIFO_WMK_HIGH   0x04
 
#define PRESSURE20_INT_STAT_FIFO_UNDERFLOW   0x02
 
#define PRESSURE20_INT_STAT_FIFO_OVERFLOW   0x01
 
#define PRESSURE20_INT_MASK_RESERVED   0x80
 Pressure 20 INTERRUPT_MASK register settings.
 
#define PRESSURE20_INT_MASK_PRESS_DELTA   0x40
 
#define PRESSURE20_INT_MASK_PRESS_ABS   0x20
 
#define PRESSURE20_INT_MASK_FIFO_WMK_LOW   0x08
 
#define PRESSURE20_INT_MASK_FIFO_WMK_HIGH   0x04
 
#define PRESSURE20_INT_MASK_FIFO_UNDERFLOW   0x02
 
#define PRESSURE20_INT_MASK_FIFO_OVERFLOW   0x01
 
#define PRESSURE20_INT_MASK_ALL   0xFF
 
#define PRESSURE20_DEVICE_ID   0x63
 Pressure 20 Device ID value.
 
#define PRESSURE20_PRESSURE_RES_RAW   0x020000ul
 Pressure 20 pressure and temperature calculation values.
 
#define PRESSURE20_PRESSURE_RES_MBAR   400
 
#define PRESSURE20_PRESSURE_OFFSET_MBAR   700
 
#define PRESSURE20_TEMPERATURE_RES_RAW   0x040000ul
 
#define PRESSURE20_TEMPERATURE_RES_C   65
 
#define PRESSURE20_TEMPERATURE_OFFSET_C   25
 
#define PRESSURE20_SPI_READ_REG   0x3C
 Pressure 20 SPI Read/Write command.
 
#define PRESSURE20_SPI_WRITE_REG   0x33
 
#define PRESSURE20_DEVICE_ADDRESS_0   0x63
 Pressure 20 device address setting.
 
#define PRESSURE20_DEVICE_ADDRESS_1   0x64
 
#define PRESSURE20_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define PRESSURE20_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define PRESSURE20_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* pressure20_master_io_t) (struct pressure20_s *, uint8_t, uint8_t *, uint8_t)
 Pressure 20 Click driver interface.
 
typedef struct pressure20_s pressure20_t
 Pressure 20 Click context object.
 

Enumerations

enum  pressure20_drv_t { PRESSURE20_DRV_SEL_SPI , PRESSURE20_DRV_SEL_I2C }
 Pressure 20 Click driver selector. More...
 
enum  pressure20_return_value_t { PRESSURE20_OK = 0 , PRESSURE20_ERROR = -1 }
 Pressure 20 Click return value data. More...
 

Functions

void pressure20_cfg_setup (pressure20_cfg_t *cfg)
 Pressure 20 configuration object setup function.
 
void pressure20_drv_interface_selection (pressure20_cfg_t *cfg, pressure20_drv_t drv_sel)
 Pressure 20 driver interface setup function.
 
err_t pressure20_init (pressure20_t *ctx, pressure20_cfg_t *cfg)
 Pressure 20 initialization function.
 
err_t pressure20_default_cfg (pressure20_t *ctx)
 Pressure 20 default configuration function.
 
err_t pressure20_generic_write (pressure20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Pressure 20 data writing function.
 
err_t pressure20_generic_read (pressure20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Pressure 20 data reading function.
 
err_t pressure20_write_register (pressure20_t *ctx, uint8_t reg, uint8_t data_in)
 Pressure 20 write register function.
 
err_t pressure20_read_register (pressure20_t *ctx, uint8_t reg, uint8_t *data_out)
 Pressure 20 read register function.
 
err_t pressure20_check_communication (pressure20_t *ctx)
 Pressure 20 check communication function.
 
err_t pressure20_write_mode_select (pressure20_t *ctx, uint8_t mode_select)
 Pressure 20 write mode select function.
 
err_t pressure20_read_otp_data (pressure20_t *ctx, uint8_t otp_address, uint8_t *data_out)
 Pressure 20 read otp data function.
 
err_t pressure20_read_data (pressure20_t *ctx, float *pressure, float *temperature)
 Pressure 20 read data function.
 
uint8_t pressure20_get_int_pin (pressure20_t *ctx)
 Pressure 20 get int pin function.
 
err_t pressure20_clear_interrupts (pressure20_t *ctx)
 Pressure 20 clear interrupts function.
 

Detailed Description

This file contains API for Pressure 20 Click Driver.

Typedef Documentation

◆ pressure20_master_io_t

typedef err_t(* pressure20_master_io_t) (struct pressure20_s *, uint8_t, uint8_t *, uint8_t)

Pressure 20 Click driver interface.

Definition of driver interface of Pressure 20 Click driver. Driver serial interface.

◆ pressure20_t

typedef struct pressure20_s pressure20_t

Pressure 20 Click context object.

Context object definition of Pressure 20 Click driver.

Enumeration Type Documentation

◆ pressure20_drv_t

Pressure 20 Click driver selector.

Selects target driver interface of Pressure 20 Click driver.

Enumerator
PRESSURE20_DRV_SEL_SPI 

SPI driver descriptor.

PRESSURE20_DRV_SEL_I2C 

I2C driver descriptor.

◆ pressure20_return_value_t

Pressure 20 Click return value data.

Predefined enum values for driver return values.

Enumerator
PRESSURE20_OK 
PRESSURE20_ERROR