barometer3 2.0.0.0
barometer3.h File Reference

This file contains API for Barometer 3 Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  barometer3_s
 Click ctx object definition. More...
 
struct  barometer3_cfg_t
 Click configuration structure definition. More...
 

Macros

#define BAROMETER3_MAP_MIKROBUS(cfg, mikrobus)
 
#define BAROMETER3_MASTER_I2C   0
 
#define BAROMETER3_MASTER_SPI   1
 
#define BAROMETER3_RETVAL   uint8_t
 
#define BAROMETER3_OK   0x00
 
#define BAROMETER3_INIT_ERROR   0xFF
 
#define BAROMETER3_I2C_SLV_ADR_GND   0x76
 
#define BAROMETER3_I2C_SLV_ADR_VCC   0x77
 
#define BAROMETER3_READ_BIT_MASK   0x80
 
#define BAROMETER3_WRITE_BIT_MASK   0x7F
 
#define BAROMETER3_PSR_B2   0x00
 
#define BAROMETER3_PSR_B1   0x01
 
#define BAROMETER3_PSR_B0   0x02
 
#define BAROMETER3_TMP_B2   0x03
 
#define BAROMETER3_TMP_B1   0x04
 
#define BAROMETER3_TMP_B0   0x05
 
#define BAROMETER3_PRS_CFG   0x06
 
#define BAROMETER3_TMP_CFG   0x07
 
#define BAROMETER3_MEAS_CFG   0x08
 
#define BAROMETER3_CFG_REG   0x09
 
#define BAROMETER3_INT_STS   0x0A
 
#define BAROMETER3_FIFO_STS   0x0B
 
#define BAROMETER3_RESET   0x0C
 
#define BAROMETER3_PROD_ID   0x0D
 
#define BAROMETER3_COEF_C0   0x10
 
#define BAROMETER3_COEF_C0_C1   0x11
 
#define BAROMETER3_COEF_C1   0x12
 
#define BAROMETER3_COEF_C00_MSB   0x13
 
#define BAROMETER3_COEF_C00_LSB   0x14
 
#define BAROMETER3_COEF_C00_C10   0x15
 
#define BAROMETER3_COEF_C10_MSB   0x16
 
#define BAROMETER3_COEF_C10_LSB   0x17
 
#define BAROMETER3_COEF_C01_MSB   0x18
 
#define BAROMETER3_COEF_C01_LSB   0x19
 
#define BAROMETER3_COEF_C11_MSB   0x1A
 
#define BAROMETER3_COEF_C11_LSB   0x1B
 
#define BAROMETER3_COEF_C20_MSB   0x1C
 
#define BAROMETER3_COEF_C20_LSB   0x1D
 
#define BAROMETER3_COEF_C21_MSB   0x1E
 
#define BAROMETER3_COEF_C21_LSB   0x1F
 
#define BAROMETER3_COEF_C30_MSB   0x20
 
#define BAROMETER3_COEF_C30_LSB   0x21
 
#define BAROMETER3_COEF_SRCE   0x28
 
#define BAROMETER3_PM_RATE_1   0x00
 
#define BAROMETER3_PM_RATE_2   0x10
 
#define BAROMETER3_PM_RATE_4   0x20
 
#define BAROMETER3_PM_RATE_8   0x30
 
#define BAROMETER3_PM_RATE_16   0x40
 
#define BAROMETER3_PM_RATE_32   0x50
 
#define BAROMETER3_PM_RATE_64   0x60
 
#define BAROMETER3_PM_RATE_128   0x70
 
#define BAROMETER3_PM_PRC_1   0x00
 
#define BAROMETER3_PM_PRC_2   0x01
 
#define BAROMETER3_PM_PRC_4   0x02
 
#define BAROMETER3_PM_PRC_8   0x03
 
#define BAROMETER3_PM_PRC_16   0x04
 
#define BAROMETER3_PM_PRC_32   0x05
 
#define BAROMETER3_PM_PRC_64   0x06
 
#define BAROMETER3_PM_PRC_128   0x07
 
#define BAROMETER3_TMP_INT   0x00
 
#define BAROMETER3_TMP_EXT   0x80
 
#define BAROMETER3_TMP_RATE_1   0x00
 
#define BAROMETER3_TMP_RATE_2   0x10
 
#define BAROMETER3_TMP_RATE_4   0x20
 
#define BAROMETER3_TMP_RATE_8   0x30
 
#define BAROMETER3_TMP_RATE_16   0x40
 
#define BAROMETER3_TMP_RATE_32   0x50
 
#define BAROMETER3_TMP_RATE_64   0x60
 
#define BAROMETER3_TMP_RATE_128   0x70
 
#define BAROMETER3_TMP_PRC_1   0x00
 
#define BAROMETER3_TMP_PRC_2   0x01
 
#define BAROMETER3_TMP_PRC_4   0x02
 
#define BAROMETER3_TMP_PRC_8   0x03
 
#define BAROMETER3_TMP_PRC_16   0x04
 
#define BAROMETER3_TMP_PRC_32   0x05
 
#define BAROMETER3_TMP_PRC_64   0x06
 
#define BAROMETER3_TMP_PRC_128   0x07
 
#define BAROMETER3_COEF_RDY   0x80
 
#define BAROMETER3_SENSOR_RDY   0x40
 
#define BAROMETER3_TMP_RDY   0x20
 
#define BAROMETER3_PRS_RDY   0x10
 
#define BAROMETER3_MEAS_CTRL_IDLE   0x00
 
#define BAROMETER3_MEAS_CTRL_CMD_PM   0x01
 
#define BAROMETER3_MEAS_CTRL_CMD_TM   0x02
 
#define BAROMETER3_MEAS_CTRL_CONT_PM   0x05
 
#define BAROMETER3_MEAS_CTRL_CONT_TM   0x06
 
#define BAROMETER3_MEAS_CTRL_CONT_MEAS   0x07
 
#define BAROMETER3_INT_HL_ACT_L   0x00
 
#define BAROMETER3_INT_HL_ACT_H   0x80
 
#define BAROMETER3_INT_FIFO   0x40
 
#define BAROMETER3_INT_TMP   0x20
 
#define BAROMETER3_INT_PRS   0x10
 
#define BAROMETER3_T_SHIFT   0x08
 
#define BAROMETER3_P_SHIFT   0x04
 
#define BAROMETER3_FIFO_EN   0x02
 
#define BAROMETER3_SPI_MODE_4_WIRE   0x00
 
#define BAROMETER3_SPI_MODE_3_WIRE   0x01
 
#define BAROMETER3_INT_FIFO_FULL   0x04
 
#define BAROMETER3_INT_TMP_FLG   0x02
 
#define BAROMETER3_INT_PRS_FLG   0x01
 
#define BAROMETER3_FIFO_FULL   0x02
 
#define BAROMETER3_FIFO_EMPTY   0x01
 
#define BAROMETER3_FIFO_SIZE   32
 
#define BAROMETER3_FIFO_FLUSH   0x80
 
#define BAROMETER3_SOFT_RST   0x09
 
#define BAROMETER3_TMP_COEF_SRCE   0x80
 
#define BAROMETER3_SCALE_FCTR_OSR_1   524288
 
#define BAROMETER3_SCALE_FCTR_OSR_2   1572864
 
#define BAROMETER3_SCALE_FCTR_OSR_4   3670016
 
#define BAROMETER3_SCALE_FCTR_OSR_8   7864320
 
#define BAROMETER3_SCALE_FCTR_OSR_16   253952
 
#define BAROMETER3_SCALE_FCTR_OSR_32   516096
 
#define BAROMETER3_SCALE_FCTR_OSR_64   1040384
 
#define BAROMETER3_SCALE_FCTR_OSR_128   2088960
 
#define BAROMETER3_SUCCESS   0
 
#define BAROMETER3_BUSY   1
 
#define BAROMETER3_MAX_BUSYTIME   990
 
#define BAROMETER3_FAIL   2
 
#define BAROMETER3_UNFIN   3
 
#define BAROMETER3_SPI_DUMMY   0x00
 
#define SPI_COMMUNICATION   1
 
#define I2C_COMMUNICATION   2
 
#define BAROMETER3_PRODUCT_ID   0x10
 
#define BAROMETER3_PASCAL_TO_MBAR   100
 

Typedefs

typedef uint8_t barometer3_select_t
 Communication type.
 
typedef void(* barometer3_master_io_t) (struct barometer3_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct barometer3_s barometer3_t
 Click ctx object definition.
 

Functions

void barometer3_cfg_setup (barometer3_cfg_t *cfg)
 Config Object Initialization function.
 
BAROMETER3_RETVAL barometer3_init (barometer3_t *ctx, barometer3_cfg_t *cfg)
 Initialization function.
 
void barometer3_generic_write (barometer3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void barometer3_generic_read (barometer3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t barometer3_read_byte (barometer3_t *ctx, uint8_t reg_adr)
 Read byte function.
 
void barometer3_read_coeffs (barometer3_t *ctx)
 Read Calculation Coefficients function.
 
void barometer3_set_op_mode (barometer3_t *ctx, uint8_t op_mode)
 Set mode of operation function.
 
void barometer3_flush_fifo (barometer3_t *ctx)
 Flush FIFO function.
 
void barometer3_disable_fifo (barometer3_t *ctx)
 Disable FIFO function.
 
void barometer3_standby (barometer3_t *ctx)
 Standby function.
 
void barometer3_cfg_temp (barometer3_t *ctx, uint8_t temp_mr, uint8_t temp_osr)
 Temperature Measurement Configuration function.
 
void barometer3_cfg_pres (barometer3_t *ctx, uint8_t prs_mr, uint8_t prs_osr)
 Pressure Measurement Configuration function.
 
uint8_t barometer3_st_meas_temp_once (barometer3_t *ctx, uint8_t temp_osr)
 Start Measure Temperature Once function.
 
uint8_t barometer3_st_meas_pres_once (barometer3_t *ctx, uint8_t prs_osr)
 Start Measure Pressure Once function.
 
void barometer3_get_raw_res (barometer3_t *ctx, uint8_t reg_adr, int32_t *raw)
 Get Raw Measurement results.
 
float barometer3_calc_temp (barometer3_t *ctx, int32_t raw)
 Temperature Calculation function.
 
float barometer3_calc_pres (barometer3_t *ctx, int32_t raw)
 Pressure Calculation function.
 
uint8_t barometer3_get_single_res (barometer3_t *ctx, float *result)
 Get Single measurement function.
 
uint8_t barometer3_meas_temp_once (barometer3_t *ctx, float *result, uint8_t temp_osr)
 Get Temperature Measurement Once function.
 
uint8_t barometer3_meas_prs_once (barometer3_t *ctx, float *result, uint8_t prs_osr)
 Get Pressure Measurement Once function.
 
void barometer3_def_cfg (barometer3_t *ctx)
 Apply Default Configuration function.
 
uint8_t barometer3_get_fifo_val (barometer3_t *ctx, int32_t *value)
 Get FIFO Value function.
 
uint8_t barometer3_get_cont_res (barometer3_t *ctx, float *temp_buf, float *prs_buf)
 Get Continuous results function.
 
uint8_t barometer3_check_int (barometer3_t *ctx)
 Check interrupt ststus function.
 

Detailed Description

This file contains API for Barometer 3 Click driver.