barometer2 2.0.0.0
barometer2.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  barometer2_t
 Click ctx object definition. More...
 
struct  barometer2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define BAROMETER2_MAP_MIKROBUS(cfg, mikrobus)
 
#define BAROMETER2_RETVAL   uint8_t
 
#define BAROMETER2_OK   0x00
 
#define BAROMETER2_INIT_ERROR   0xFF
 
#define BAROMETER2_REG_INTERRUPT_CONFIG   0x0B
 
#define BAROMETER2_REG_THRESHOLD_LSB   0x0C
 
#define BAROMETER2_REG_THRESHOLD_MSB   0x0D
 
#define BAROMETER2_REG_WHO_AM_I   0x0F
 
#define BAROMETER2_REG_CTRL_1   0x10
 
#define BAROMETER2_REG_CTRL_2   0x11
 
#define BAROMETER2_REG_CTRL_3   0x12
 
#define BAROMETER2_REG_FIFO_CTRL   0x14
 
#define BAROMETER2_REG_REF_P_XL   0x15
 
#define BAROMETER2_REG_REF_P_L   0x16
 
#define BAROMETER2_REG_REF_P_H   0x17
 
#define BAROMETER2_REG_RPDS_LSB   0x18
 
#define BAROMETER2_REG_RPDS_MSB   0x19
 
#define BAROMETER2_REG_RES_CONFIG   0x1A
 
#define BAROMETER2_REG_INT_SOURCE   0x25
 
#define BAROMETER2_REG_FIFO_STATUS   0x26
 
#define BAROMETER2_REG_STATUS   0x27
 
#define BAROMETER2_REG_PRESSURE_OUT_XL   0x28
 
#define BAROMETER2_REG_PRESSURE_OUT_L   0x29
 
#define BAROMETER2_REG_PRESSURE_OUT_H   0x2A
 
#define BAROMETER2_REG_TEMPERATURE_LSB   0x2B
 
#define BAROMETER2_REG_TEMPERATURE_MSB   0x2C
 
#define BAROMETER2_REG_LPFP_RES   0x33
 
#define BAROMETER2_ICFG_AUTORIFP_DISABLE   0x00
 
#define BAROMETER2_ICFG_AUTORIFP_ENABLE   0x80
 
#define BAROMETER2_ICFG_AUTORIFP_NO_RESET   0x00
 
#define BAROMETER2_ICFG_AUTORIFP_RESET   0x40
 
#define BAROMETER2_ICFG_AUTOZERO_DISABLE   0x00
 
#define BAROMETER2_ICFG_AUTOZERO_ENABLE   0x20
 
#define BAROMETER2_ICFG_AUTOZERO_NO_RESET   0x00
 
#define BAROMETER2_ICFG_AUTOZERO_RESET   0x10
 
#define BAROMETER2_ICFG_INT_GENERATION_DISABLE   0x00
 
#define BAROMETER2_ICFG_INT_GENERATION_ENABLE   0x08
 
#define BAROMETER2_ICFG_INT_NOT_LATCHED   0x00
 
#define BAROMETER2_ICFG_INT_LATCHED   0x04
 
#define BAROMETER2_ICFG_INT_PLE_DISABLE   0x00
 
#define BAROMETER2_ICFG_INT_PLE_ENABLE   0x02
 
#define BAROMETER2_ICFG_INT_PHE_DISABLE   0x00
 
#define BAROMETER2_ICFG_INT_PHE_ENABLE   0x01
 
#define BAROMETER2_CTRL1_ODR_1Hz   0x10
 
#define BAROMETER2_CTRL1_ODR_10Hz   0x20
 
#define BAROMETER2_CTRL1_ODR_25Hz   0x30
 
#define BAROMETER2_CTRL1_ODR_50Hz   0x40
 
#define BAROMETER2_CTRL1_ODR_75Hz   0x50
 
#define BAROMETER2_CTRL1_LPFP_DISABLE   0x00
 
#define BAROMETER2_CTRL1_LPFP_ENABLE   0x08
 
#define BAROMETER2_CTRL1_LPFP_CFG_ODR_2   0x00
 
#define BAROMETER2_CTRL1_LPFP_CFG_ODR_9   0x08
 
#define BAROMETER2_CTRL1_LPFP_CFG_ODR_10   0x0C
 
#define BAROMETER2_CTRL1_BDU_CONT_UPDATE   0x00
 
#define BAROMETER2_CTRL1_BDU_NOT_UPDATE   0x02
 
#define BAROMETER2_CTRL2_BOOT_NORMAL_MODE   0x00
 
#define BAROMETER2_CTRL2_BOOT_REBOOT_MEMORY   0x80
 
#define BAROMETER2_CTRL2_FIFO_DISABLED   0x00
 
#define BAROMETER2_CTRL2_FIFO_ENABLED   0x40
 
#define BAROMETER2_CTRL2_FIFO_THR_DISABLED   0x00
 
#define BAROMETER2_CTRL2_FIFO_THR_ENABLED   0x20
 
#define BAROMETER2_CTRL2_ID_ADD_INC_DISABLED   0x00
 
#define BAROMETER2_CTRL2_ID_ADD_INC_ENABLED   0x10
 
#define BAROMETER2_CTRL2_SOFTWARE_RESET   0x04
 
#define BAROMETER2_CTRL2_MODE_IDLE   0x01
 
#define BAROMETER2_CTRL3_INT_ACTIVE_HIGH   0x00
 
#define BAROMETER2_CTRL3_INT_ACTIVE_LOW   0x80
 
#define BAROMETER2_CTRL3_INT_PUSH_PULL   0x00
 
#define BAROMETER2_CTRL3_INT_OPEN_DRAIN   0x40
 
#define BAROMETER2_CTRL3_FIFO_FULL_DISABLED   0x00
 
#define BAROMETER2_CTRL3_FIFO_FULL_ENABLED   0x20
 
#define BAROMETER2_CTRL3_FIFO_WTM_DISABLED   0x00
 
#define BAROMETER2_CTRL3_FIFO_WTM_ENABLED   0x10
 
#define BAROMETER2_CTRL3_FIFO_OVERRUN_DISABLED   0x00
 
#define BAROMETER2_CTRL3_FIFO_OVERRUN_ENABLED   0x08
 
#define BAROMETER2_CTRL3_DRDY_DISABLED   0x00
 
#define BAROMETER2_CTRL3_DRDY_ENABLED   0x04
 
#define BAROMETER2_CTRL3_DRDY_STATUS_P_HIGH   0x01
 
#define BAROMETER2_CTRL3_DRDY_STATUS_P_LOW   0x02
 
#define BAROMETER2_FIFO_CTRL_BYPASS_MODE   0x00
 
#define BAROMETER2_FIFO_CTRL_FIFO_MODE   0x20
 
#define BAROMETER2_FIFO_CTRL_STREAM_MODE   0x40
 
#define BAROMETER2_FIFO_CTRL_STREAM_TO_FIFO_MODE   0x60
 
#define BAROMETER2_FIFO_CTRL_BYPASS_TO_STREAM_MODE   0x80
 
#define BAROMETER2_FIFO_CTRL_DYNAMIC_STREAM_MODE   0xC0
 
#define BAROMETER2_FIFO_CTRL_BYPASS_TO_FIFO_MODE   0xE0
 
#define BAROMETER2_RESCFG_NORMAL_MODE   0x00
 
#define BAROMETER2_RESCFG_LOW_CURRENT_MODE   0x01
 
#define BAROMETER2_WHO_AM_I   0xB1
 
#define BAROMETER2_DEVICE_SLAVE_ADDR_GND   0x5C
 
#define BAROMETER2_DEVICE_SLAVE_ADDR_VCC   0x5D
 
#define BAROMETER2_PRESSURE_DATA_IN_mBar   0
 
#define BAROMETER2_PRESSURE_DATA_IN_hPa   0
 
#define BAROMETER2_PRESSURE_DATA_IN_kPa   2
 
#define BAROMETER2_PRESSURE_DATA_IN_Torr   1
 
#define BAROMETER2_PRESSURE_DATA_IN_mmHg   1
 
#define BAROMETER2_PRESSURE_DATA_IN_Bar   3
 
#define BAROMETER2_TEMPERATURE_IN_CELSIUS   0x00
 
#define BAROMETER2_TEMPERATURE_IN_KELVIN   0x01
 
#define BAROMETER2_TEMPERATURE_IN_FARENHAJT   0x02
 

Functions

void barometer2_cfg_setup (barometer2_cfg_t *cfg)
 Config Object Initialization function.
 
BAROMETER2_RETVAL barometer2_init (barometer2_t *ctx, barometer2_cfg_t *cfg)
 Initialization function.
 
void barometer2_default_cfg (barometer2_t *ctx)
 Click Default Configuration function.
 
void barometer2_generic_write (barometer2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void barometer2_generic_read (barometer2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void barometer2_write_byte (barometer2_t *ctx, uint8_t reg, uint8_t data_bytes)
 Write one byte function.
 
uint8_t barometer2_read_byte (barometer2_t *ctx, uint8_t reg)
 Read one byte function.
 
float barometer2_get_temperature (barometer2_t *ctx, uint8_t temp_format)
 Read temperature function.
 
void barometer2_software_reset (barometer2_t *ctx)
 Reset function.
 
float barometer2_get_pressure (barometer2_t *ctx, uint8_t press_format)
 Read pressure function.
 
uint8_t barometer2_get_interrupt (barometer2_t *ctx)
 Gets interrupt.
 

Detailed Description

This file contains API for Barometer 2 Click driver.