pressure23 2.1.0.0
pressure23.h File Reference

This file contains API for Pressure 23 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  pressure23_s
 Pressure 23 Click context object. More...
 
struct  pressure23_cfg_t
 Pressure 23 Click configuration object. More...
 
struct  pressure23_sensor_cfg_t
 Pressure 23 Click sensor configuration object. More...
 

Macros

#define PRESSURE23_REG_SERIAL_NUMBER_MSB   0x02
 Pressure 23 description register.
 
#define PRESSURE23_REG_SERIAL_NUMBER_LSB   0x03
 
#define PRESSURE23_REG_COEF_C1   0x04
 
#define PRESSURE23_REG_COEF_C2   0x05
 
#define PRESSURE23_REG_COEF_C3   0x06
 
#define PRESSURE23_REG_COEF_C4   0x07
 
#define PRESSURE23_REG_COEF_C5   0x08
 
#define PRESSURE23_REG_COEF_C6   0x09
 
#define PRESSURE23_REG_COEF_C7   0x0A
 
#define PRESSURE23_REG_COEF_C8   0x0B
 
#define PRESSURE23_REG_COEF_C9   0x0C
 
#define PRESSURE23_REG_COEF_C10   0x0D
 
#define PRESSURE23_REG_PROM_ID_CRC   0x0F
 
#define PRESSURE23_CMD_RESET   0x10
 Pressure 23 description command.
 
#define PRESSURE23_CMD_WRITE_CONFIG_PRESS   0x20
 
#define PRESSURE23_CMD_WRITE_CONFIG_TEMP   0x22
 
#define PRESSURE23_CMD_READ_CONFIG_PRESS   0x28
 
#define PRESSURE23_CMD_READ_CONFIG_TEMP   0x2A
 
#define PRESSURE23_CMD_READ_MEMORY   0xE0
 
#define PRESSURE23_CMD_START_CONVERSION   0x40
 
#define PRESSURE23_CMD_START_CONVERSION_PRESS   0x44
 
#define PRESSURE23_CMD_START_CONVERSION_TEMP   0x48
 
#define PRESSURE23_CMD_READ_ADC_REG   0x50
 
#define PRESSURE23_CMD_READ_ADC_REG_PRESS   0x54
 
#define PRESSURE23_CMD_READ_ADC_REG_TEMP   0x58
 
#define PRESSURE23_CMD_WRITE_OPERATION_REG   0x14
 
#define PRESSURE23_CMD_READ_OPERATION_REG   0x16
 
#define PRESSURE23_CMD_WRITE_INTERRUPT_MASK   0x18
 
#define PRESSURE23_CMD_READ_INTERRUPT_MASK   0x1A
 
#define PRESSURE23_CMD_WRITE_INTERRUPT_REG   0x1C
 
#define PRESSURE23_CMD_READ_INTERRUPT_REG   0x1E
 
#define PRESSURE23_CMD_WRITE_LIMIT_REG_TEMP_L   0x30
 
#define PRESSURE23_CMD_WRITE_LIMIT_REG_TEMP_H   0x32
 
#define PRESSURE23_CMD_WRITE_LIMIT_REG_PRESS_L   0x34
 
#define PRESSURE23_CMD_WRITE_LIMIT_REG_PRESS_H   0x36
 
#define PRESSURE23_CMD_READ_LIMIT_REG_TEMP_L   0x38
 
#define PRESSURE23_CMD_READ_LIMIT_REG_TEMP_H   0x3A
 
#define PRESSURE23_CMD_READ_LIMIT_REG_PRESS_L   0x3C
 
#define PRESSURE23_CMD_READ_LIMIT_REG_PRESS_H   0x3E
 
#define PRESSURE23_SNSR_CFG_SEL_PRESS   0x00
 Pressure 23 description of sensor configuration data.
 
#define PRESSURE23_SNSR_CFG_SEL_TEMP   0x01
 
#define PRESSURE23_SNSR_CFG_SEL_BIT_MASK   0x01
 
#define PRESSURE23_SNSR_CFG_RATIO_OFF   0x00
 
#define PRESSURE23_SNSR_CFG_RATIO_1   0x01
 
#define PRESSURE23_SNSR_CFG_RATIO_2   0x02
 
#define PRESSURE23_SNSR_CFG_RATIO_4   0x03
 
#define PRESSURE23_SNSR_CFG_RATIO_8   0x04
 
#define PRESSURE23_SNSR_CFG_RATIO_16   0x05
 
#define PRESSURE23_SNSR_CFG_RATIO_32   0x06
 
#define PRESSURE23_SNSR_CFG_RATIO_BIT_MASK   0x07
 
#define PRESSURE23_SNSR_CFG_FILTER_OFF   0x00
 
#define PRESSURE23_SNSR_CFG_FILTER_2   0x01
 
#define PRESSURE23_SNSR_CFG_FILTER_4   0x02
 
#define PRESSURE23_SNSR_CFG_FILTER_8   0x03
 
#define PRESSURE23_SNSR_CFG_FILTER_16   0x04
 
#define PRESSURE23_SNSR_CFG_FILTER_32   0x05
 
#define PRESSURE23_SNSR_CFG_FILTER_BIT_MASK   0x07
 
#define PRESSURE23_SNSR_CFG_RES_24_BIT   0x00
 
#define PRESSURE23_SNSR_CFG_RES_16_BIT   0x01
 
#define PRESSURE23_SNSR_CFG_RES_8_BIT   0x02
 
#define PRESSURE23_SNSR_CFG_RES_BIT_MASK   0x03
 
#define PRESSURE23_SNSR_CFG_OSR_0   0x00
 
#define PRESSURE23_SNSR_CFG_OSR_1   0x01
 
#define PRESSURE23_SNSR_CFG_OSR_2   0x02
 
#define PRESSURE23_SNSR_CFG_OSR_3   0x03
 
#define PRESSURE23_SNSR_CFG_OSR_4   0x04
 
#define PRESSURE23_SNSR_CFG_OSR_5   0x05
 
#define PRESSURE23_SNSR_CFG_OSR_6   0x06
 
#define PRESSURE23_SNSR_CFG_OSR_BIT_MASK   0x07
 
#define PRESSURE23_CNV_ADC_SEL_PRESS   0x00
 Pressure 23 description of conversion selection and ADC selection data.
 
#define PRESSURE23_CNV_ADC_SEL_TEMP   0x01
 
#define PRESSURE23_CNV_ADC_BIT_MASK   0x01
 
#define PRESSURE23_CNV_ADC_REG_BIT_MASK   0x04
 
#define PRESSURE23_OP_REG_FIFO_INT_TH_OFF   0x00
 Pressure 23 description of operation register data.
 
#define PRESSURE23_OP_REG_FIFO_INT_TH_BIT_MASK   0x1F
 
#define PRESSURE23_OP_REG_FIFO_MODE_OFF   0x00
 
#define PRESSURE23_OP_REG_FIFO_MODE_BIT_MASK   0x03
 
#define PRESSURE23_OP_REG_DELAY_OFF   0x00
 
#define PRESSURE23_OP_REG_DELAY_5_MS   0x01
 
#define PRESSURE23_OP_REG_DELAY_10_MS   0x02
 
#define PRESSURE23_OP_REG_DELAY_20_MS   0x03
 
#define PRESSURE23_OP_REG_DELAY_50_MS   0x04
 
#define PRESSURE23_OP_REG_DELAY_100_MS   0x05
 
#define PRESSURE23_OP_REG_DELAY_200_MS   0x06
 
#define PRESSURE23_OP_REG_DELAY_500_MS   0x07
 
#define PRESSURE23_OP_REG_DELAY_1_SEC   0x08
 
#define PRESSURE23_OP_REG_DELAY_2_SEC   0x09
 
#define PRESSURE23_OP_REG_DELAY_5_SEC   0x0A
 
#define PRESSURE23_OP_REG_DELAY_10_SEC   0x0B
 
#define PRESSURE23_OP_REG_DELAY_20_SEC   0x0C
 
#define PRESSURE23_OP_REG_DELAY_60_SEC   0x0D
 
#define PRESSURE23_OP_REG_DELAY_BIT_MASK   0x0F
 
#define PRESSURE23_LIM_REG_SEL_TEMP   0x00
 Pressure 23 description of limit register data.
 
#define PRESSURE23_LIM_REG_SEL_PRESS   0x01
 
#define PRESSURE23_LIM_REG_SEL_BIT_MASK   0x01
 
#define PRESSURE23_LIM_REG_LIM_LOW   0x00
 
#define PRESSURE23_LIM_REG_LIM_HIGH   0x01
 
#define PRESSURE23_LIM_REG_LIM_BIT_MASK   0x01
 
#define PRESSURE23_COEF_TEMP_D2_DIV   536870912.0f
 Pressure 23 calculation coefficients.
 
#define PRESSURE23_COEF_TEMP_D1_DIV   34359738368.0f
 
#define PRESSURE23_COEF_TEMP_C2_DIV   64.0f
 
#define PRESSURE23_COEF_OFF_SENS_DIV   512.0f
 
#define PRESSURE23_COEF_PRESS_DIV   4194304.0f
 
#define PRESSURE23_DEVICE_ADDRESS_GND   0x77
 Pressure 23 device address setting.
 
#define PRESSURE23_DEVICE_ADDRESS_VCC   0x76
 
#define PRESSURE23_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define PRESSURE23_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define PRESSURE23_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* pressure23_master_io_t) (struct pressure23_s *, uint8_t, uint8_t *, uint8_t)
 Pressure 23 Click driver interface.
 
typedef struct pressure23_s pressure23_t
 Pressure 23 Click context object.
 

Enumerations

enum  pressure23_drv_t { PRESSURE23_DRV_SEL_SPI , PRESSURE23_DRV_SEL_I2C }
 Pressure 23 Click driver selector. More...
 
enum  pressure23_return_value_t { PRESSURE23_OK = 0 , PRESSURE23_ERROR = -1 }
 Pressure 23 Click return value data. More...
 

Functions

void pressure23_cfg_setup (pressure23_cfg_t *cfg)
 Pressure 23 configuration object setup function.
 
void pressure23_drv_interface_selection (pressure23_cfg_t *cfg, pressure23_drv_t drv_sel)
 Pressure 23 driver interface setup function.
 
err_t pressure23_init (pressure23_t *ctx, pressure23_cfg_t *cfg)
 Pressure 23 initialization function.
 
err_t pressure23_default_cfg (pressure23_t *ctx)
 Pressure 23 default configuration function.
 
err_t pressure23_generic_write (pressure23_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Pressure 23 data writing function.
 
err_t pressure23_generic_read (pressure23_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Pressure 23 data reading function.
 
err_t pressure23_set_command (pressure23_t *ctx, uint8_t cmd)
 Pressure 23 set the command function.
 
err_t pressure23_sw_reset (pressure23_t *ctx)
 Pressure 23 software reset function.
 
err_t pressure23_read_memory (pressure23_t *ctx, uint8_t reg, uint16_t *prom)
 Pressure 23 read memory function.
 
err_t pressure23_start_conversion (pressure23_t *ctx, uint8_t sel_cnv)
 Pressure 23 start the conversion function.
 
err_t pressure23_write_config (pressure23_t *ctx, pressure23_sensor_cfg_t config)
 Pressure 23 configuration data writing function.
 
err_t pressure23_read_config (pressure23_t *ctx, uint8_t sel_cfg, pressure23_sensor_cfg_t *config)
 Pressure 23 configuration data reading function.
 
err_t pressure23_read_adc (pressure23_t *ctx, uint8_t sel_data, uint32_t *adc_data)
 Pressure 23 ADC data reading function.
 
err_t pressure23_write_op_reg (pressure23_t *ctx, uint8_t fifo_int_th, uint8_t fifo_mode, uint8_t delay)
 Pressure 23 operation register data writing function.
 
err_t pressure23_read_op_reg (pressure23_t *ctx, uint8_t *fifo_int_th, uint8_t *fifo_mode, uint8_t *delay)
 Pressure 23 operation register data reading function.
 
err_t pressure23_write_int_mask (pressure23_t *ctx, uint16_t int_mask_data)
 Pressure 23 interrupt mask data writing function.
 
err_t pressure23_read_int_mask (pressure23_t *ctx, uint16_t *int_mask_data)
 Pressure 23 interrupt mask data reading function.
 
err_t pressure23_write_int_reg (pressure23_t *ctx, uint16_t int_reg_data)
 Pressure 23 interrupt register data writing function.
 
err_t pressure23_read_int_reg (pressure23_t *ctx, uint16_t *int_reg_data)
 Pressure 23 interrupt register data reading function.
 
err_t pressure23_write_lim_reg (pressure23_t *ctx, uint8_t sel_adr, uint8_t sel_lim, uint16_t lim_reg_data)
 Pressure 23 limit register data writing function.
 
err_t pressure23_read_lim_reg (pressure23_t *ctx, uint8_t sel_adr, uint8_t sel_lim, uint16_t *lim_reg_data)
 Pressure 23 limit register data reading function.
 
err_t pressure23_get_adc_data_press (pressure23_t *ctx, uint32_t *pressure)
 Pressure 23 get the ADC pressure data function.
 
err_t pressure23_get_adc_data_temp (pressure23_t *ctx, uint32_t *temperature)
 Pressure 23 get the ADC temperature data function.
 
err_t pressure23_get_calibration_data (pressure23_t *ctx)
 Pressure 23 gets the calibration data function.
 
err_t pressure23_get_measurement_data (pressure23_t *ctx, float *pressure, float *temperature)
 Pressure 23 gets the measurement data function.
 
uint8_t pressure23_get_interrupt (pressure23_t *ctx)
 Pressure 23 gets the interrupt function.
 

Detailed Description

This file contains API for Pressure 23 Click Driver.

Typedef Documentation

◆ pressure23_master_io_t

typedef err_t(* pressure23_master_io_t) (struct pressure23_s *, uint8_t, uint8_t *, uint8_t)

Pressure 23 Click driver interface.

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

◆ pressure23_t

typedef struct pressure23_s pressure23_t

Pressure 23 Click context object.

Context object definition of Pressure 23 Click driver.

Enumeration Type Documentation

◆ pressure23_drv_t

Pressure 23 Click driver selector.

Selects target driver interface of Pressure 23 Click driver.

Enumerator
PRESSURE23_DRV_SEL_SPI 

SPI driver descriptor.

PRESSURE23_DRV_SEL_I2C 

I2C driver descriptor.

◆ pressure23_return_value_t

Pressure 23 Click return value data.

Predefined enum values for driver return values.

Enumerator
PRESSURE23_OK 
PRESSURE23_ERROR