pressure18 2.1.0.0
pressure18.h File Reference

This file contains API for Pressure 18 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  pressure18_calib_coef_t
 Pressure 18 Click calibration coefficients object. More...
 
struct  pressure18_s
 Pressure 18 Click context object. More...
 
struct  pressure18_cfg_t
 Pressure 18 Click configuration object. More...
 

Macros

#define PRESSURE18_REG_CHIP_ID   0x00
 Pressure 18 register map.
 
#define PRESSURE18_REG_ERR   0x02
 
#define PRESSURE18_REG_STATUS   0x03
 
#define PRESSURE18_REG_DATA_0   0x04
 
#define PRESSURE18_REG_DATA_1   0x05
 
#define PRESSURE18_REG_DATA_2   0x06
 
#define PRESSURE18_REG_DATA_3   0x07
 
#define PRESSURE18_REG_DATA_4   0x08
 
#define PRESSURE18_REG_DATA_5   0x09
 
#define PRESSURE18_REG_SENSOR_TIME_0   0x0C
 
#define PRESSURE18_REG_SENSOR_TIME_1   0x0D
 
#define PRESSURE18_REG_SENSOR_TIME_2   0x0E
 
#define PRESSURE18_REG_SENSOR_TIME_3   0x0F
 
#define PRESSURE18_REG_EVENT   0x10
 
#define PRESSURE18_REG_INT_STATUS   0x11
 
#define PRESSURE18_REG_FIFO_LENGTH_0   0x12
 
#define PRESSURE18_REG_FIFO_LENGTH_1   0x13
 
#define PRESSURE18_REG_FIFO_DATA   0x14
 
#define PRESSURE18_REG_FIFO_WTM_0   0x15
 
#define PRESSURE18_REG_FIFO_WTM_1   0x16
 
#define PRESSURE18_REG_FIFO_CONFIG_1   0x17
 
#define PRESSURE18_REG_FIFO_CONFIG_2   0x18
 
#define PRESSURE18_REG_INT_CTRL   0x19
 
#define PRESSURE18_REG_IF_CONF   0x1A
 
#define PRESSURE18_REG_PWR_CTRL   0x1B
 
#define PRESSURE18_REG_OSR   0x1C
 
#define PRESSURE18_REG_ODR   0x1D
 
#define PRESSURE18_REG_CONFIG   0x1F
 
#define PRESSURE18_REG_CALIB_DATA   0x31
 
#define PRESSURE18_REG_CMD   0x7E
 
#define PRESSURE18_CHIP_ID   0x50
 Pressure 18 chip id setting.
 
#define PRESSURE18_ERR_FATAL   0x01
 Pressure 18 ERR register settings.
 
#define PRESSURE18_ERR_CMD   0x02
 
#define PRESSURE18_ERR_CONF   0x04
 
#define PRESSURE18_STATUS_CMD_RDY   0x10
 Pressure 18 STATUS register settings.
 
#define PRESSURE18_STATUS_DRDY_PRESS   0x20
 
#define PRESSURE18_STATUS_DRDY_TEMP   0x40
 
#define PRESSURE18_INT_CTRL_OD_PUSH_PULL   0x00
 Pressure 18 INT_CTRL register settings.
 
#define PRESSURE18_INT_CTRL_OD_OPEN_DRAIN   0x01
 
#define PRESSURE18_INT_CTRL_LEVEL_ACTIVE_LOW   0x00
 
#define PRESSURE18_INT_CTRL_LEVEL_ACTIVE_HIGH   0x02
 
#define PRESSURE18_INT_CTRL_LATCH_DISABLED   0x00
 
#define PRESSURE18_INT_CTRL_LATCH_ENABLED   0x04
 
#define PRESSURE18_INT_CTRL_FWTM_DISABLED   0x00
 
#define PRESSURE18_INT_CTRL_FWTM_ENABLED   0x08
 
#define PRESSURE18_INT_CTRL_FFULL_DISABLED   0x00
 
#define PRESSURE18_INT_CTRL_FFULL_ENABLED   0x10
 
#define PRESSURE18_INT_CTRL_DRDY_DISABLED   0x00
 
#define PRESSURE18_INT_CTRL_DRDY_ENABLED   0x40
 
#define PRESSURE18_PWR_CTRL_PRESS_EN   0x01
 Pressure 18 PWR_CTRL register settings.
 
#define PRESSURE18_PWR_CTRL_TEMP_EN   0x02
 
#define PRESSURE18_PWR_CTRL_MODE_SLEEP   0x00
 
#define PRESSURE18_PWR_CTRL_MODE_FORCED   0x10
 
#define PRESSURE18_PWR_CTRL_MODE_NORMAL   0x30
 
#define PRESSURE18_OSR_P_X1   0x00
 Pressure 18 OSR register settings.
 
#define PRESSURE18_OSR_P_X2   0x01
 
#define PRESSURE18_OSR_P_X4   0x02
 
#define PRESSURE18_OSR_P_X8   0x03
 
#define PRESSURE18_OSR_P_X16   0x04
 
#define PRESSURE18_OSR_P_X32   0x05
 
#define PRESSURE18_OSR_T_X1   0x00
 
#define PRESSURE18_OSR_T_X2   0x08
 
#define PRESSURE18_OSR_T_X4   0x10
 
#define PRESSURE18_OSR_T_X8   0x18
 
#define PRESSURE18_OSR_T_X16   0x20
 
#define PRESSURE18_OSR_T_X32   0x28
 
#define PRESSURE18_ODR_5_MS   0x00
 Pressure 18 ODR register settings.
 
#define PRESSURE18_ODR_10_MS   0x01
 
#define PRESSURE18_ODR_20_MS   0x02
 
#define PRESSURE18_ODR_40_MS   0x03
 
#define PRESSURE18_ODR_80_MS   0x04
 
#define PRESSURE18_ODR_160_MS   0x05
 
#define PRESSURE18_ODR_320_MS   0x06
 
#define PRESSURE18_ODR_640_MS   0x07
 
#define PRESSURE18_ODR_1p280_S   0x08
 
#define PRESSURE18_ODR_2p560_S   0x09
 
#define PRESSURE18_ODR_5p120_S   0x0A
 
#define PRESSURE18_ODR_10p24_S   0x0B
 
#define PRESSURE18_ODR_20p48_S   0x0C
 
#define PRESSURE18_ODR_40p96_S   0x0D
 
#define PRESSURE18_ODR_81p92_S   0x0E
 
#define PRESSURE18_ODR_163p84_S   0x0F
 
#define PRESSURE18_ODR_327p68_S   0x10
 
#define PRESSURE18_ODR_655p36_S   0x11
 
#define PRESSURE18_CMD_NOP   0x00
 Pressure 18 CMD register settings.
 
#define PRESSURE18_CMD_EXTMODE_EN_MIDDLE   0x34
 
#define PRESSURE18_CMD_FIFO_FLUSH   0xB0
 
#define PRESSURE18_CMD_SOFT_RESET   0xB6
 
#define PRESSURE18_PA_TO_MBAR   0.01
 Pressure 18 Pascal to mBar conversion value.
 
#define PRESSURE18_DEVICE_ADDRESS_0   0x76
 Pressure 18 device address setting.
 
#define PRESSURE18_DEVICE_ADDRESS_1   0x77
 
#define PRESSURE18_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define PRESSURE18_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define PRESSURE18_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* pressure18_master_io_t) (struct pressure18_s *, uint8_t, uint8_t *, uint8_t)
 Pressure 18 Click driver interface.
 
typedef struct pressure18_s pressure18_t
 Pressure 18 Click context object.
 

Enumerations

enum  pressure18_drv_t { PRESSURE18_DRV_SEL_SPI , PRESSURE18_DRV_SEL_I2C }
 Pressure 18 Click driver selector. More...
 
enum  pressure18_return_value_t { PRESSURE18_OK = 0 , PRESSURE18_ERROR = -1 }
 Pressure 18 Click return value data. More...
 

Functions

void pressure18_cfg_setup (pressure18_cfg_t *cfg)
 Pressure 18 configuration object setup function.
 
void pressure18_drv_interface_selection (pressure18_cfg_t *cfg, pressure18_drv_t drv_sel)
 Pressure 18 driver interface setup function.
 
err_t pressure18_init (pressure18_t *ctx, pressure18_cfg_t *cfg)
 Pressure 18 initialization function.
 
err_t pressure18_default_cfg (pressure18_t *ctx)
 Pressure 18 default configuration function.
 
err_t pressure18_generic_write (pressure18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Pressure 18 data writing function.
 
err_t pressure18_generic_read (pressure18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Pressure 18 data reading function.
 
err_t pressure18_write_register (pressure18_t *ctx, uint8_t reg, uint8_t data_in)
 Pressure 18 write register function.
 
err_t pressure18_read_register (pressure18_t *ctx, uint8_t reg, uint8_t *data_out)
 Pressure 18 read register function.
 
err_t pressure18_check_communication (pressure18_t *ctx)
 Pressure 18 check communication function.
 
uint8_t pressure18_get_int_pin (pressure18_t *ctx)
 Pressure 18 get int pin function.
 
err_t pressure18_soft_reset (pressure18_t *ctx)
 Pressure 18 soft reset function.
 
err_t pressure18_read_data (pressure18_t *ctx, float *pressure, float *temperature)
 Pressure 18 read data function.
 

Detailed Description

This file contains API for Pressure 18 Click Driver.

Typedef Documentation

◆ pressure18_master_io_t

typedef err_t(* pressure18_master_io_t) (struct pressure18_s *, uint8_t, uint8_t *, uint8_t)

Pressure 18 Click driver interface.

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

◆ pressure18_t

typedef struct pressure18_s pressure18_t

Pressure 18 Click context object.

Context object definition of Pressure 18 Click driver.

Enumeration Type Documentation

◆ pressure18_drv_t

Pressure 18 Click driver selector.

Selects target driver interface of Pressure 18 Click driver.

Enumerator
PRESSURE18_DRV_SEL_SPI 

SPI driver descriptor.

PRESSURE18_DRV_SEL_I2C 

I2C driver descriptor.

◆ pressure18_return_value_t

Pressure 18 Click return value data.

Predefined enum values for driver return values.

Enumerator
PRESSURE18_OK 
PRESSURE18_ERROR