accelpressure 2.1.0.0
accelpressure.h File Reference

This file contains API for AccelPressure Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  accelpressure_t
 AccelPressure Click context object. More...
 
struct  accelpressure_cfg_t
 AccelPressure Click configuration object. More...
 
struct  accelpressure_axes_t
 AccelPressure Click axes data. More...
 

Macros

#define ACCELPRESSURE_ACC_REG_INT_STATUS   0x00
 AccelPressure accel - FXLS8974CF description register.
 
#define ACCELPRESSURE_ACC_REG_TEMP_OUT   0x01
 
#define ACCELPRESSURE_ACC_REG_VECM_LSB   0x02
 
#define ACCELPRESSURE_ACC_REG_VECM_MSB   0x03
 
#define ACCELPRESSURE_ACC_REG_OUT_X_LSB   0x04
 
#define ACCELPRESSURE_ACC_REG_OUT_X_MSB   0x05
 
#define ACCELPRESSURE_ACC_REG_OUT_Y_LSB   0x06
 
#define ACCELPRESSURE_ACC_REG_OUT_Y_MSB   0x07
 
#define ACCELPRESSURE_ACC_REG_OUT_Z_LSB   0x08
 
#define ACCELPRESSURE_ACC_REG_OUT_Z_MSB   0x09
 
#define ACCELPRESSURE_ACC_REG_BUF_STATUS   0x0B
 
#define ACCELPRESSURE_ACC_REG_BUF_X_LSB   0x0C
 
#define ACCELPRESSURE_ACC_REG_BUF_X_MSB   0x0D
 
#define ACCELPRESSURE_ACC_REG_BUF_Y_LSB   0x0E
 
#define ACCELPRESSURE_ACC_REG_BUF_Y_MSB   0x0F
 
#define ACCELPRESSURE_ACC_REG_BUF_Z_LSB   0x10
 
#define ACCELPRESSURE_ACC_REG_BUF_Z_MSB   0x11
 
#define ACCELPRESSURE_ACC_REG_PROD_REV   0x12
 
#define ACCELPRESSURE_ACC_REG_WHO_AM_I   0x13
 
#define ACCELPRESSURE_ACC_REG_SYS_MODE   0x14
 
#define ACCELPRESSURE_ACC_REG_SENS_CONFIG1   0x15
 
#define ACCELPRESSURE_ACC_REG_SENS_CONFIG2   0x16
 
#define ACCELPRESSURE_ACC_REG_SENS_CONFIG3   0x17
 
#define ACCELPRESSURE_ACC_REG_SENS_CONFIG4   0x18
 
#define ACCELPRESSURE_ACC_REG_SENS_CONFIG5   0x19
 
#define ACCELPRESSURE_ACC_REG_WAKE_IDLE_LSB   0x1A
 
#define ACCELPRESSURE_ACC_REG_WAKE_IDLE_MSB   0x1B
 
#define ACCELPRESSURE_ACC_REG_SLEEP_IDLE_LSB   0x1C
 
#define ACCELPRESSURE_ACC_REG_SLEEP_IDLE_MSB   0x1D
 
#define ACCELPRESSURE_ACC_REG_ASLP_COUNT_LSB   0x1E
 
#define ACCELPRESSURE_ACC_REG_ASLP_COUNT_MSB   0x1F
 
#define ACCELPRESSURE_ACC_REG_INT_EN   0x20
 
#define ACCELPRESSURE_ACC_REG_INT_PIN_SEL   0x21
 
#define ACCELPRESSURE_ACC_REG_OFF_X   0x22
 
#define ACCELPRESSURE_ACC_REG_OFF_Y   0x23
 
#define ACCELPRESSURE_ACC_REG_OFF_Z   0x24
 
#define ACCELPRESSURE_ACC_REG_BUF_CONFIG1   0x26
 
#define ACCELPRESSURE_ACC_REG_BUF_CONFIG2   0x27
 
#define ACCELPRESSURE_ACC_REG_ORIENT_STATUS   0x28
 
#define ACCELPRESSURE_ACC_REG_ORIENT_CONFIG   0x29
 
#define ACCELPRESSURE_ACC_REG_ORIENT_DBCOUNT   0x2A
 
#define ACCELPRESSURE_ACC_REG_ORIENT_BF_ZCOMP   0x2B
 
#define ACCELPRESSURE_ACC_REG_ORIENT_THS_REG   0x2C
 
#define ACCELPRESSURE_ACC_REG_SDCD_INT_SRC1   0x2D
 
#define ACCELPRESSURE_ACC_REG_SDCD_INT_SRC2   0x2E
 
#define ACCELPRESSURE_ACC_REG_SDCD_CONFIG1   0x2F
 
#define ACCELPRESSURE_ACC_REG_SDCD_CONFIG2   0x30
 
#define ACCELPRESSURE_ACC_REG_SDCD_OT_DBCNT   0x31
 
#define ACCELPRESSURE_ACC_REG_SDCD_WT_DBCNT   0x32
 
#define ACCELPRESSURE_ACC_REG_SDCD_LTHS_LSB   0x33
 
#define ACCELPRESSURE_ACC_REG_SDCD_LTHS_MSB   0x34
 
#define ACCELPRESSURE_ACC_REG_SDCD_UTHS_LSB   0x35
 
#define ACCELPRESSURE_ACC_REG_SDCD_UTHS_MSB   0x36
 
#define ACCELPRESSURE_ACC_REG_SELF_TEST_CONFIG1   0x37
 
#define ACCELPRESSURE_ACC_REG_SELF_TEST_CONFIG2   0x38
 
#define ACCELPRESSURE_PRESS_REG_STATUS   0x00
 AccelPressure pressure - MPL3115A2 description register.
 
#define ACCELPRESSURE_PRESS_REG_OUT_P_MSB   0x01
 
#define ACCELPRESSURE_PRESS_REG_OUT_P_CSB   0x02
 
#define ACCELPRESSURE_PRESS_REG_OUT_P_LSB   0x03
 
#define ACCELPRESSURE_PRESS_REG_OUT_T_MSB   0x04
 
#define ACCELPRESSURE_PRESS_REG_OUT_T_LSB   0x05
 
#define ACCELPRESSURE_PRESS_REG_DR_STATUS   0x06
 
#define ACCELPRESSURE_PRESS_REG_OUT_P_DELTA_MSB   0x07
 
#define ACCELPRESSURE_PRESS_REG_OUT_P_DELTA_CSB   0x08
 
#define ACCELPRESSURE_PRESS_REG_OUT_P_DELTA_LSB   0x09
 
#define ACCELPRESSURE_PRESS_REG_OUT_T_DELTA_MSB   0x0A
 
#define ACCELPRESSURE_PRESS_REG_OUT_T_DELTA_LSB   0x0B
 
#define ACCELPRESSURE_PRESS_REG_WHO_AM_I   0x0C
 
#define ACCELPRESSURE_PRESS_REG_FIFO_STATUS   0x0D
 
#define ACCELPRESSURE_PRESS_REG_FIFO_DATA   0x0E
 
#define ACCELPRESSURE_PRESS_REG_FIFO_SETUP   0x0F
 
#define ACCELPRESSURE_PRESS_REG_TIME_DLY   0x10
 
#define ACCELPRESSURE_PRESS_REG_SYSMOD   0x11
 
#define ACCELPRESSURE_PRESS_REG_INT_SOURCE   0x12
 
#define ACCELPRESSURE_PRESS_REG_PT_DATA_CFG   0x13
 
#define ACCELPRESSURE_PRESS_REG_BAR_IN_MSB   0x14
 
#define ACCELPRESSURE_PRESS_REG_BAR_IN_LSB   0x15
 
#define ACCELPRESSURE_PRESS_REG_P_TGT_MSB   0x16
 
#define ACCELPRESSURE_PRESS_REG_P_TGT_LSB   0x17
 
#define ACCELPRESSURE_PRESS_REG_T_TGT   0x18
 
#define ACCELPRESSURE_PRESS_REG_P_WND_MSB   0x19
 
#define ACCELPRESSURE_PRESS_REG_P_WND_LSB   0x1A
 
#define ACCELPRESSURE_PRESS_REG_T_WND   0x1B
 
#define ACCELPRESSURE_PRESS_REG_P_MIN_MSB   0x1C
 
#define ACCELPRESSURE_PRESS_REG_P_MIN_CSB   0x1D
 
#define ACCELPRESSURE_PRESS_REG_P_MIN_LSB   0x1E
 
#define ACCELPRESSURE_PRESS_REG_T_MIN_MSB   0x1F
 
#define ACCELPRESSURE_PRESS_REG_T_MIN_LSB   0x20
 
#define ACCELPRESSURE_PRESS_REG_P_MAX_MSB   0x21
 
#define ACCELPRESSURE_PRESS_REG_P_MAX_CSB   0x22
 
#define ACCELPRESSURE_PRESS_REG_P_MAX_LSB   0x23
 
#define ACCELPRESSURE_PRESS_REG_T_MAX_MSB   0x24
 
#define ACCELPRESSURE_PRESS_REG_T_MAX_LSB   0x25
 
#define ACCELPRESSURE_PRESS_REG_CTRL1   0x26
 
#define ACCELPRESSURE_PRESS_REG_CTRL2   0x27
 
#define ACCELPRESSURE_PRESS_REG_CTRL3   0x28
 
#define ACCELPRESSURE_PRESS_REG_CTRL4   0x29
 
#define ACCELPRESSURE_PRESS_REG_CTRL5   0x2A
 
#define ACCELPRESSURE_PRESS_REG_OFF_P   0x2B
 
#define ACCELPRESSURE_PRESS_REG_OFF_T   0x2C
 
#define ACCELPRESSURE_PRESS_REG_OFF_H   0x2D
 
#define ACCELPRESSURE_ACC_SRC_BOOT_COMPLETED   0x01
 AccelPressure accelerometer nominal sensitivity data values.
 
#define ACCELPRESSURE_ACC_DEVICE_ID_VAL   0x86
 AccelPressure accelerometer device ID data values.
 
#define ACCELPRESSURE_ACC_SW_RESET_BIT_MASK   0x80
 AccelPressure accelerometer SW reset bit mask data values.
 
#define ACCELPRESSURE_ACC_OP_MODE_STANDBY   0x00
 AccelPressure accelerometer operating mode data values.
 
#define ACCELPRESSURE_ACC_OP_MODE_ACTIVE   0x01
 
#define ACCELPRESSURE_ACC_OP_MODE_BIT_MASK   0xFE
 
#define ACCELPRESSURE_ACC_FSR_SEL_2G   0x00
 AccelPressure accelerometer full-scale measurement range (FSR) selection.
 
#define ACCELPRESSURE_ACC_FSR_SEL_4G   0x01
 
#define ACCELPRESSURE_ACC_FSR_SEL_8G   0x02
 
#define ACCELPRESSURE_ACC_FSR_SEL_16G   0x03
 
#define ACCELPRESSURE_ACC_FSR_SEL_BIT_MASK   0xF9
 
#define ACCELPRESSURE_ACC_INT_EN_DRDY_DIS   0x00
 AccelPressure accelerometer data-ready interrupt output enable data values.
 
#define ACCELPRESSURE_ACC_INT_EN_DRDY_EN   0x80
 
#define ACCELPRESSURE_ACC_FSR_SENS_VAL_2G   0.98f
 AccelPressure accelerometer nominal sensitivity data values.
 
#define ACCELPRESSURE_ACC_FSR_SENS_VAL_4G   1.95f
 
#define ACCELPRESSURE_ACC_FSR_SENS_VAL_8G   3.91f
 
#define ACCELPRESSURE_ACC_FSR_SENS_VAL_16G   7.81f
 
#define ACCELPRESSURE_PRESS_STATUS_FLAG_TDR   0x02
 AccelPressure pressure status data values.
 
#define ACCELPRESSURE_PRESS_STATUS_FLAG_PDR   0x04
 
#define ACCELPRESSURE_PRESS_STATUS_FLAG_PTDR   0x08
 
#define ACCELPRESSURE_PRESS_STATUS_FLAG_TOW   0x20
 
#define ACCELPRESSURE_PRESS_STATUS_FLAG_POW   0x40
 
#define ACCELPRESSURE_PRESS_STATUS_FLAG_PTOW   0x80
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_DRDY   0x80
 AccelPressure pressure interrupt source flag data values.
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_FIFO   0x40
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_PW   0x20
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_TW   0x10
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_PTH   0x08
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_TTH   0x04
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_PCHG   0x02
 
#define ACCELPRESSURE_PRESS_INT_SOURCE_FLAG_TCHG   0x01
 
#define ACCELPRESSURE_PRESS_CTRL1_ALT_BARO   0x00
 AccelPressure pressure control register 1 bit mask.
 
#define ACCELPRESSURE_PRESS_CTRL1_ALT_ALTI   0x80
 
#define ACCELPRESSURE_PRESS_CTRL1_ALT_BITMASK   0x7F
 
#define ACCELPRESSURE_PRESS_CTRL1_SBYB   0x01
 
#define ACCELPRESSURE_PRESS_CTRL1_OST   0x02
 
#define ACCELPRESSURE_PRESS_CTRL1_CLR   0x03
 
#define ACCELPRESSURE_PRESS_CTRL1_RST   0x04
 
#define ACCELPRESSURE_PRESS_CTRL1_RAW   0x40
 
#define ACCELPRESSURE_PRESS_CTRL1_ALT   0x80
 
#define ACCELPRESSURE_PRESS_CTRL1_BAR   0x00
 
#define ACCELPRESSURE_PRESS_CTRL1_OS1_6MS   0x00
 
#define ACCELPRESSURE_PRESS_CTRL1_OS2_10MS   0x08
 
#define ACCELPRESSURE_PRESS_CTRL1_OS4_18MS   0x10
 
#define ACCELPRESSURE_PRESS_CTRL1_OS8_34MS   0x18
 
#define ACCELPRESSURE_PRESS_CTRL1_OS16_66MS   0x20
 
#define ACCELPRESSURE_PRESS_CTRL1_OS32_130MS   0x28
 
#define ACCELPRESSURE_PRESS_CTRL1_OS64_258MS   0x30
 
#define ACCELPRESSURE_PRESS_CTRL1_OS128_512MS   0x38
 
#define ACCELPRESSURE_PRESS_MODE_BAROMETER   0x00
 AccelPressure pressure operating mode data values.
 
#define ACCELPRESSURE_PRESS_MODE_ALTIMETER   0x01
 
#define ACCELPRESSURE_PRESS_CTRL3_INT1_POL_HIGH   0x20
 AccelPressure pressure control register 3 bit mask.
 
#define ACCELPRESSURE_PRESS_CTRL3_INT1_POL_LOW   0x00
 
#define ACCELPRESSURE_PRESS_CTRL3_INT1_OD   0x10
 
#define ACCELPRESSURE_PRESS_CTRL3_INT2_POL_HIGH   0x02
 
#define ACCELPRESSURE_PRESS_CTRL3_INT2_POL_LOW   0x00
 
#define ACCELPRESSURE_PRESS_CTRL3_INT2_OD   0x01
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_DRDY   0x80
 AccelPressure pressure control register 4 bit mask.
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_FIFO   0x40
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_PW   0x20
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_TW   0x10
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_PTH   0x08
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_TTH   0x04
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_PCHG   0x02
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_EN_TCHG   0x01
 
#define ACCELPRESSURE_PRESS_CTRL4_INT_DIS_ALL   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_DRDY   0x80
 AccelPressure pressure control register 5 bit mask.
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_DRDY   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_FIFO   0x40
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_FIFO   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_PW   0x20
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_PW   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_TW   0x10
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_TW   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_PTH   0x08
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_PTH   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_TTH   0x04
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_TTH   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_PCHG   0x02
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_PCHG   0x00
 
#define ACCELPRESSURE_PRESS_CTRL5_INT1_TCHG   0x01
 
#define ACCELPRESSURE_PRESS_CTRL5_INT2_TCHG   0x00
 
#define ACCELPRESSURE_PRESS_F_SETUP_FIFO_DISABLE   0x00
 AccelPressure pressure FIFO setup register bit mask.
 
#define ACCELPRESSURE_PRESS_F_SETUP_FIFO_CIR_BUFF   0x40
 
#define ACCELPRESSURE_PRESS_F_SETUP_FIFO_STOP_MODE   0x80
 
#define ACCELPRESSURE_PRESS_PT_DATA_DR_EVENT_EN   0x04
 AccelPressure pressure sensor data register bit mask.
 
#define ACCELPRESSURE_PRESS_PT_DATA_PD_EVENT_EN   0x02
 
#define ACCELPRESSURE_PRESS_PT_DATA_TD_EVENT_EN   0x01
 
#define ACCELPRESSURE_PRESS_PT_DATA_ALL_EVENTS_DIS   0x00
 
#define ACCELPRESSURE_PRESS_PRESSURE_SENS   0.25f
 AccelPressure pressure and temperature calculation data values.
 
#define ACCELPRESSURE_PRESS_CONVERT_PA_TO_MBAR   100.0f
 
#define ACCELPRESSURE_PRESS_TEMP_SENS   0.0625f
 
#define ACCELPRESSURE_DEVICE_ADDRESS_ACCEL   0x18
 AccelPressure device address setting.
 
#define ACCELPRESSURE_DEVICE_ADDRESS_PRESS   0x60
 
#define ACCELPRESSURE_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  accelpressure_return_value_t { ACCELPRESSURE_OK = 0 , ACCELPRESSURE_ERROR = -1 }
 AccelPressure Click return value data. More...
 

Functions

void accelpressure_cfg_setup (accelpressure_cfg_t *cfg)
 AccelPressure configuration object setup function.
 
err_t accelpressure_init (accelpressure_t *ctx, accelpressure_cfg_t *cfg)
 AccelPressure initialization function.
 
err_t accelpressure_default_cfg (accelpressure_t *ctx)
 AccelPressure default configuration function.
 
err_t accelpressure_acc_reg_write (accelpressure_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 AccelPressure accel I2C writing function.
 
err_t accelpressure_acc_reg_read (accelpressure_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 AccelPressure accel I2C reading function.
 
err_t accelpressure_press_reg_write (accelpressure_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 AccelPressure pressure I2C writing function.
 
err_t accelpressure_press_reg_read (accelpressure_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 AccelPressure pressure I2C reading function.
 
err_t accelpressure_get_device_id (accelpressure_t *ctx, uint8_t *device_id)
 AccelPressure get device ID function.
 
err_t accelpressure_get_status (accelpressure_t *ctx, uint8_t *status)
 AccelPressure get status function.
 
err_t accelpressure_sw_reset (accelpressure_t *ctx)
 AccelPressure soft reset function.
 
err_t accelpressure_set_acc_mode (accelpressure_t *ctx, uint8_t op_mode)
 AccelPressure set accel operating mode function.
 
err_t accelpressure_set_fsr (accelpressure_t *ctx, uint8_t fsr)
 AccelPressure set FSR function.
 
err_t accelpressure_get_axes_data (accelpressure_t *ctx, accelpressure_axes_t *axes)
 AccelPressure get the accel sensor axes function.
 
err_t accelpressure_set_press_mode (accelpressure_t *ctx, uint8_t op_mode)
 AccelPressure set pressure operating mode function.
 
err_t accelpressure_get_drdy_status (accelpressure_t *ctx, uint8_t *drdy)
 AccelPressure get data ready status function.
 
err_t accelpressure_get_pressure (accelpressure_t *ctx, float *pressure)
 AccelPressure get pressure data function.
 
err_t accelpressure_get_temperature (accelpressure_t *ctx, float *temperature)
 AccelPressure get temperature data function.
 
uint8_t accelpressure_get_mot_det (accelpressure_t *ctx)
 AccelPressure get motion detect state function.
 

Detailed Description

This file contains API for AccelPressure Click Driver.

Enumeration Type Documentation

◆ accelpressure_return_value_t

AccelPressure Click return value data.

Predefined enum values for driver return values.

Enumerator
ACCELPRESSURE_OK 
ACCELPRESSURE_ERROR