barometer9 2.1.0.0
barometer9.h File Reference

This file contains API for Barometer 9 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  barometer9_s
 Barometer 9 Click context object. More...
 
struct  barometer9_cfg_t
 Barometer 9 Click configuration object. More...
 

Macros

#define BAROMETER9_REG_PART_ID0   0x00
 Barometer 9 description register.
 
#define BAROMETER9_REG_PART_ID1   0x01
 
#define BAROMETER9_REG_UIND0   0x02
 
#define BAROMETER9_REG_UIND1   0x03
 
#define BAROMETER9_REG_UIND2   0x04
 
#define BAROMETER9_REG_UIND3   0x05
 
#define BAROMETER9_MODE_CFG   0x06
 
#define BAROMETER9_MEAS_CFG   0x07
 
#define BAROMETER9_STBY_CFG   0x08
 
#define BAROMETER9_OVS_CFG   0x09
 
#define BAROMETER9_MAVG_CFG   0x0A
 
#define BAROMETER9_INTF_CFG   0x0B
 
#define BAROMETER9_INT_CFG   0x0C
 
#define BAROMETER9_PRESS_LO_XL_CFG   0x0D
 
#define BAROMETER9_PRESS_LO_L_CFG   0x0E
 
#define BAROMETER9_PRESS_LO_H_CFG   0x0F
 
#define BAROMETER9_PRESS_HI_XL_CFG   0x10
 
#define BAROMETER9_PRESS_HI_L_CFG   0x11
 
#define BAROMETER9_PRESS_HI_H_CFG   0x12
 
#define BAROMETER9_FIFO_CFG   0x13
 
#define BAROMETER9_DATA_STAT   0x14
 
#define BAROMETER9_FIFO_STAT   0x15
 
#define BAROMETER9_INT_STAT   0x16
 
#define BAROMETER9_PRESS_OUT_XL   0x17
 
#define BAROMETER9_PRESS_OUT_L   0x18
 
#define BAROMETER9_PRESS_OUT_H   0x19
 
#define BAROMETER9_TEMP_OUT_L   0x1A
 
#define BAROMETER9_TEMP_OUT_H   0x1B
 
#define BAROMETER9_PRESS_OUT_F_XL   0x27
 
#define BAROMETER9_PRESS_OUT_F_L   0x28
 
#define BAROMETER9_PRESS_OUT_F_H   0x29
 
#define BAROMETER9_HIGH_POWER_MODE   0x80
 Barometer 9 description setting.
 
#define BAROMETER9_LOW_POWER_MODE   0x00
 
#define BAROMETER9_DIRECT_PATH   0x00
 
#define BAROMETER9_FIFO_MODE   0x20
 
#define BAROMETER9_AVERAGE_MODE   0x40
 
#define BAROMETER9_IDLE_MODE   0x00
 
#define BAROMETER9_MEASURMENT_MODE   0x10
 
#define BAROMETER9_SW_RESET   0x08
 
#define BAROMETER9_READ_PRESS_ONLY   0x01
 
#define BAROMETER9_READ_TEMP_ONLY   0x02
 
#define BAROMETER9_READ_PRES_AND_TEMP   0x03
 
#define BAROMETER9_P_CONV_0   0x00
 Barometer 9 MEAS_CFG register setting.
 
#define BAROMETER9_P_CONV_1   0x08
 
#define BAROMETER9_P_CONV_2   0x10
 
#define BAROMETER9_PT_RATE_1   0x00
 
#define BAROMETER9_PT_RATE_4   0x01
 
#define BAROMETER9_PT_RATE_8   0x02
 
#define BAROMETER9_PT_RATE_16   0x03
 
#define BAROMETER9_PT_RATE_32   0x04
 
#define BAROMETER9_PT_RATE_64   0x05
 
#define BAROMETER9_PT_RATE_128   0x06
 
#define BAROMETER9_PT_RATE_256   0x07
 
#define BAROMETER9_TEMPERATURE_CON_CONST   128
 Barometer 9 conversion constants.
 
#define BAROMETER9_K_TO_C_CON_CONST   273.15f
 
#define BAROMETER9_PRESSURE_CON_CONST   64
 
#define BAROMETER9_DEVICE_ID   0x0321
 Barometer 9 Device ID value.
 
#define BAROMETER9_DEVICE_ADDRESS   0x20
 Barometer 9 device address setting.
 
#define BAROMETER9_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define BAROMETER9_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define BAROMETER9_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* barometer9_master_io_t) (struct barometer9_s *, uint8_t, uint8_t *, uint8_t)
 
typedef struct barometer9_s barometer9_t
 Barometer 9 Click context object.
 

Enumerations

enum  barometer9_drv_t { BAROMETER9_DRV_SEL_SPI , BAROMETER9_DRV_SEL_I2C }
 Barometer 9 Click driver selector. More...
 
enum  barometer9_return_value_t { BAROMETER9_OK = 0 , BAROMETER9_ERROR = -1 }
 Barometer 9 Click return value data. More...
 

Functions

void barometer9_cfg_setup (barometer9_cfg_t *cfg)
 Barometer 9 configuration object setup function.
 
void barometer9_drv_interface_sel (barometer9_cfg_t *cfg, barometer9_drv_t drv_sel)
 Barometer 9 driver interface setup function.
 
err_t barometer9_init (barometer9_t *ctx, barometer9_cfg_t *cfg)
 Barometer 9 initialization function.
 
err_t barometer9_default_cfg (barometer9_t *ctx)
 Barometer 9 default configuration function.
 
err_t barometer9_generic_write (barometer9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Barometer 9 data writing function.
 
err_t barometer9_generic_read (barometer9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Barometer 9 data reading function.
 
err_t barometer9_read_part_id (barometer9_t *ctx, uint16_t *part_id)
 Barometer 9 Device ID reading function.
 
err_t barometer9_get_temperature (barometer9_t *ctx, float *temperature)
 Barometer 9 temperature reading function.
 
err_t barometer9_get_pressure (barometer9_t *ctx, float *pressure)
 Barometer 9 pressure reading function.
 
err_t barometer9_sw_reset (barometer9_t *ctx)
 Barometer 9 software reset function.
 

Detailed Description

This file contains API for Barometer 9 Click Driver.

Typedef Documentation

◆ barometer9_master_io_t

typedef err_t(* barometer9_master_io_t) (struct barometer9_s *, uint8_t, uint8_t *, uint8_t)

Driver serial interface.

◆ barometer9_t

typedef struct barometer9_s barometer9_t

Barometer 9 Click context object.

Context object definition of Barometer 9 Click driver.

Enumeration Type Documentation

◆ barometer9_drv_t

Barometer 9 Click driver selector.

Selects target driver interface of Barometer 9 Click driver.

Enumerator
BAROMETER9_DRV_SEL_SPI 

SPI driver descriptor.

BAROMETER9_DRV_SEL_I2C 

I2C driver descriptor.

◆ barometer9_return_value_t

Barometer 9 Click return value data.

Predefined enum values for driver return values.

Enumerator
BAROMETER9_OK 
BAROMETER9_ERROR