barometer8 2.0.0.0
barometer8.h File Reference

This file contains API for Barometer 8 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  barometer8_s
 Barometer 8 Click context object. More...
 
struct  barometer8_cfg_t
 Barometer 8 Click configuration object. More...
 

Macros

#define BAROMETER8_REG_INTERRUPT_CFG   0x0B
 Barometer 8 registers list.
 
#define BAROMETER8_REG_THS_P_L   0x0C
 
#define BAROMETER8_REG_THS_P_H   0x0D
 
#define BAROMETER8_REG_IF_CTRL   0x0E
 
#define BAROMETER8_REG_WHO_AM_I   0x0F
 
#define BAROMETER8_REG_CTRL_REG1   0x10
 
#define BAROMETER8_REG_CTRL_REG2   0x11
 
#define BAROMETER8_REG_CTRL_REG3   0x12
 
#define BAROMETER8_REG_FIFO_CTRL   0x14
 
#define BAROMETER8_REG_FIFO_WTM   0x15
 
#define BAROMETER8_REG_REF_P_L   0x16
 
#define BAROMETER8_REG_REF_P_H   0x17
 
#define BAROMETER8_REG_I3C_IF_CTRL   0x19
 
#define BAROMETER8_REG_RPDS_L   0x1A
 
#define BAROMETER8_REG_RPDS_H   0x1B
 
#define BAROMETER8_REG_INT_SOURCE   0x24
 
#define BAROMETER8_REG_FIFO_STATUS1   0x25
 
#define BAROMETER8_REG_FIFO_STATUS2   0x26
 
#define BAROMETER8_REG_STATUS   0x27
 
#define BAROMETER8_REG_PRESSURE_OUT_XL   0x28
 
#define BAROMETER8_REG_PRESSURE_OUT_L   0x29
 
#define BAROMETER8_REG_PRESSURE_OUT_H   0x2A
 
#define BAROMETER8_REG_TEMP_OUT_L   0x2B
 
#define BAROMETER8_REG_TEMP_OUT_H   0x2C
 
#define BAROMETER8_REG_FIFO_DATA_OUT_PRESS_XL   0x78
 
#define BAROMETER8_REG_FIFO_DATA_OUT_PRESS_L   0x79
 
#define BAROMETER8_REG_FIFO_DATA_OUT_PRESS_H   0x7A
 
#define BAROMETER8_DISABLE_I2C_AND_I3C   0x40
 Barometer 8 IF_CTRL register settings.
 
#define BAROMETER8_ENABLE_SPI_READ   0x20
 
#define BAROMETER8_SDA_PULL_UP   0x10
 
#define BAROMETER8_CS_PULL_UP_DISC   0x02
 
#define BAROMETER8_WHO_AM_I   0xB4
 Barometer 8 WHO_AM_I register value.
 
#define BAROMETER8_ODR_PD_OR_ONE_SHOT   0x00
 Barometer 8 CTRL_REG1 register settings.
 
#define BAROMETER8_ODR_1HZ   0x08
 
#define BAROMETER8_ODR_4HZ   0x10
 
#define BAROMETER8_ODR_10HZ   0x18
 
#define BAROMETER8_ODR_25HZ   0x20
 
#define BAROMETER8_ODR_50HZ   0x28
 
#define BAROMETER8_ODR_75HZ   0x30
 
#define BAROMETER8_ODR_100HZ   0x38
 
#define BAROMETER8_ODR_200HZ   0x40
 
#define BAROMETER8_ODR_BIT_MASK   0x78
 
#define BAROMETER8_AVG_4   0x00
 
#define BAROMETER8_AVG_8   0x01
 
#define BAROMETER8_AVG_16   0x02
 
#define BAROMETER8_AVG_32   0x03
 
#define BAROMETER8_AVG_64   0x04
 
#define BAROMETER8_AVG_128   0x05
 
#define BAROMETER8_AVG_512   0x07
 
#define BAROMETER8_AVG_BIT_MASK   0x07
 
#define BAROMETER8_BOOT_NORMAL   0x00
 Barometer 8 CTRL_REG2 register settings.
 
#define BAROMETER8_REBOOT_MEMORY   0x80
 
#define BAROMETER8_FS_MODE_1   0x00
 
#define BAROMETER8_FS_MODE_2   0x40
 
#define BAROMETER8_LFPF_CFG_ODR_4   0x00
 
#define BAROMETER8_LFPF_CFG_ODR_9   0x20
 
#define BAROMETER8_DISABLE_LPFP   0x00
 
#define BAROMETER8_ENABLE_LPFP   0x10
 
#define BAROMETER8_BDU_CONTINUOUS   0x00
 
#define BAROMETER8_BDU_MSB_LSB_READ   0x08
 
#define BAROMETER8_SWRESET   0x04
 
#define BAROMETER8_ONESHOT_IDLE   0x00
 
#define BAROMETER8_ONESHOT_NEW_DATA   0x01
 
#define BAROMETER8_STATUS_T_OR   0x20
 Barometer 8 STATUS register settings.
 
#define BAROMETER8_STATUS_P_OR   0x10
 
#define BAROMETER8_STATUS_T_DA   0x02
 
#define BAROMETER8_STATUS_P_DA   0x01
 
#define BAROMETER8_PRESSURE_FS_MODE_1_RES   4096.0
 Barometer 8 calculation values.
 
#define BAROMETER8_PRESSURE_FS_MODE_2_RES   2048.0
 
#define BAROMETER8_TEMPERATURE_RES   0.01
 
#define BAROMETER8_SET_DEVICE_ADDRESS   0x5C
 Barometer 8 device address setting.
 
#define BAROMETER8_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define BAROMETER8_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define BAROMETER8_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* barometer8_master_io_t) (struct barometer8_s *, uint8_t, uint8_t *, uint8_t)
 Barometer 8 Click driver interface.
 
typedef struct barometer8_s barometer8_t
 Barometer 8 Click context object.
 

Enumerations

enum  barometer8_drv_t { BAROMETER8_DRV_SEL_SPI , BAROMETER8_DRV_SEL_I2C }
 Barometer 8 Click driver selector. More...
 
enum  barometer8_return_value_t { BAROMETER8_OK = 0 , BAROMETER8_ERROR = -1 }
 Barometer 8 Click return value data. More...
 

Functions

void barometer8_cfg_setup (barometer8_cfg_t *cfg)
 Barometer 8 configuration object setup function.
 
void barometer8_drv_interface_selection (barometer8_cfg_t *cfg, barometer8_drv_t drv_sel)
 Barometer 8 driver interface setup function.
 
err_t barometer8_init (barometer8_t *ctx, barometer8_cfg_t *cfg)
 Barometer 8 initialization function.
 
err_t barometer8_default_cfg (barometer8_t *ctx)
 Barometer 8 default configuration function.
 
err_t barometer8_generic_write (barometer8_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Barometer 8 data writing function.
 
err_t barometer8_generic_read (barometer8_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Barometer 8 data reading function.
 
err_t barometer8_write_register (barometer8_t *ctx, uint8_t reg, uint8_t data_in)
 Barometer 8 write register function.
 
err_t barometer8_read_register (barometer8_t *ctx, uint8_t reg, uint8_t *data_out)
 Barometer 8 read register function.
 
err_t barometer8_check_communication (barometer8_t *ctx)
 Barometer 8 check communication function.
 
err_t barometer8_software_reset (barometer8_t *ctx)
 Barometer 8 software reset function.
 
err_t barometer8_read_data (barometer8_t *ctx, float *pressure, float *temperature)
 Barometer 8 read data function.
 

Detailed Description

This file contains API for Barometer 8 Click Driver.

Typedef Documentation

◆ barometer8_master_io_t

typedef err_t(* barometer8_master_io_t) (struct barometer8_s *, uint8_t, uint8_t *, uint8_t)

Barometer 8 Click driver interface.

Definition of driver interface of Barometer 8 Click driver. Driver serial interface.

◆ barometer8_t

typedef struct barometer8_s barometer8_t

Barometer 8 Click context object.

Context object definition of Barometer 8 Click driver.

Enumeration Type Documentation

◆ barometer8_drv_t

Barometer 8 Click driver selector.

Selects target driver interface of Barometer 8 Click driver.

Enumerator
BAROMETER8_DRV_SEL_SPI 

SPI driver descriptor.

BAROMETER8_DRV_SEL_I2C 

I2C driver descriptor.

◆ barometer8_return_value_t

Barometer 8 Click return value data.

Predefined enum values for driver return values.

Enumerator
BAROMETER8_OK 
BAROMETER8_ERROR