accel15  2.0.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions
accel15.h File Reference

This file contains API for Accel 15 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  accel15_s
 Accel 15 Click context object. More...
 
struct  accel15_cfg_t
 Accel 15 Click configuration object. More...
 
struct  accel15_axis_t
 Accel axis data structure. More...
 

Macros

#define ACCEL15_REG_CHIP_ID   0x00
 Accel 15 description register. More...
 
#define ACCEL15_REG_ERROR   0x02
 
#define ACCEL15_REG_STATUS   0x03
 
#define ACCEL15_REG_DATA_0   0x0A
 
#define ACCEL15_REG_DATA_8   0x12
 
#define ACCEL15_REG_SENSORTIME_0   0x18
 
#define ACCEL15_REG_EVENT   0x1B
 
#define ACCEL15_REG_INT_STAT_0   0x1C
 
#define ACCEL15_REG_INT_STAT_1   0x1D
 
#define ACCEL15_REG_TEMPERATURE   0x22
 
#define ACCEL15_REG_FIFO_LENGTH_0   0x24
 
#define ACCEL15_REG_FIFO_DATA   0x26
 
#define ACCEL15_REG_INTERNAL_STAT   0x2A
 
#define ACCEL15_REG_ACCEL_CONFIG   0x40
 
#define ACCEL15_REG_ACCEL_RANGE   0x41
 
#define ACCEL15_REG_AUX_CONF   0x44
 
#define ACCEL15_REG_FIFO_DOWN   0x45
 
#define ACCEL15_REG_FIFO_WTM_0   0x46
 
#define ACCEL15_REG_FIFO_CONFIG_0   0x48
 
#define ACCEL15_REG_FIFO_CONFIG_1   0x49
 
#define ACCEL15_REG_AUX_DEV_ID   0x4B
 
#define ACCEL15_REG_AUX_IF_CONF   0x4C
 
#define ACCEL15_REG_AUX_RD   0x4D
 
#define ACCEL15_REG_INT_MAP_1   0x56
 
#define ACCEL15_REG_INT_MAP_2   0x57
 
#define ACCEL15_REG_INT_MAP_DATA   0x58
 
#define ACCEL15_REG_INIT_CTRL   0x59
 
#define ACCEL15_REG_RESERVED_REG_5B   0x5B
 
#define ACCEL15_REG_RESERVED_REG_5C   0x5C
 
#define ACCEL15_REG_FEATURE_CONFIG   0x5E
 
#define ACCEL15_REG_INTERNAL_ERROR   0x5F
 
#define ACCEL15_REG_ACC_SELF_TEST   0x6D
 
#define ACCEL15_REG_ACC_SELF_TEST   0x6D
 
#define ACCEL15_REG_NV_CONFIG   0x70
 
#define ACCEL15_REG_OFFSET_0   0x71
 
#define ACCEL15_REG_OFFSET_1   0x72
 
#define ACCEL15_REG_OFFSET_2   0x73
 
#define ACCEL15_REG_POWER_CONF   0x7C
 
#define ACCEL15_REG_POWER_CTRL   0x7D
 
#define ACCEL15_REG_CMD   0x7E
 
#define ACCEL15_CHIP_ID   0x1A
 Accel 15 description setting. More...
 
#define ACCEL15_FEATURE_SIZE   0x0C
 
#define ACCEL15_RD_WR_MIN_LEN   0x02
 
#define ACCEL15_RD_WR_MAX_LEN   0x0514
 
#define ACCEL15_ANY_MOT_START_ADDR   0x00
 Accel 15 feature start address. More...
 
#define ACCEL15_NO_MOT_START_ADDR   0x04
 
#define ACCEL15_CONFIG_ID_START_ADDR   0x08
 
#define ACCEL15_AXES_REMAP_START_ADDR   0x0A
 
#define ACCEL15_X_AXIS_MSK   0x03
 Accel 15 Mask definitions for axes re-mapping. More...
 
#define ACCEL15_X_AXIS_SIGN_MSK   0x04
 
#define ACCEL15_Y_AXIS_MSK   0x18
 
#define ACCEL15_Y_AXIS_SIGN_MSK   0x20
 
#define ACCEL15_Z_AXIS_MSK   0xC0
 
#define ACCEL15_Z_AXIS_SIGN_MSK   0x01
 
#define ACCEL15_X_AXIS_SIGN_POS   0x02
 Accel 15 Bit position for axes re-mapping. More...
 
#define ACCEL15_Y_AXIS_POS   0x03
 
#define ACCEL15_Y_AXIS_SIGN_POS   0x05
 
#define ACCEL15_Z_AXIS_POS   0x06
 
#define ACCEL15_X_AXIS_EN   0x01
 Accel 15 Any/No-motion axis enable macros. More...
 
#define ACCEL15_Y_AXIS_EN   0x02
 
#define ACCEL15_Z_AXIS_EN   0x04
 
#define ACCEL15_EN_ALL_AXIS   0x07
 
#define ACCEL15_DIS_ALL_AXIS   0x00
 
#define ACCEL15_ANY_MOT_INT   0x20
 Accel 15 Interrupt status macros. More...
 
#define ACCEL15_NO_MOT_INT   0x40
 
#define ACCEL15_ERROR_INT   0x80
 
#define ACCEL15_ACCEL_OFF   0x00
 Accel 15 power ctrl macros. More...
 
#define ACCEL15_ACCEL_ON   0x04
 
#define ACCEL15_AUX_OFF   0x00
 
#define ACCEL15_AUX_ON   0x01
 
#define ACCEL15_APS_OFF   0x00
 Accel 15 power mode macros. More...
 
#define ACCEL15_APS_ON   0x01
 
#define ACCEL15_FSW_OFF   0x00
 
#define ACCEL15_FSW_ON   0x02
 
#define ACCEL15_CONFIG_MAJOR_POS   0x06
 Accel 15 Bit position for major configuration. More...
 
#define ACCEL15_DRDY   0x01
 Accel 15 Accel enable and data ready macros. More...
 
#define ACCEL15_ACCEL_EN   0x40
 
#define ACCEL15_ACCEL_DRDY   0x80
 
#define ACCEL15_SPI_WR_MASK   0x7F
 Accel 15 Interface selection macro. More...
 
#define ACCEL15_SPI_RD_MASK   0x80
 
#define ACCEL15_ENABLE   0x01
 Accel 15 enable/disable bit values. More...
 
#define ACCEL15_DISABLE   0x00
 
#define ACCEL15_CIC_AVG_MODE   0
 Accel 15 accel performance mode parameter. More...
 
#define ACCEL15_CONTINUOUS_MODE   1
 
#define ACCEL15_ADVANCE_POWER_SAVE_MSK   0x01
 Accel 15 advance power save position and mask. More...
 
#define ACCEL15_12_BIT_RESOLUTION   12
 Accel 15 sensor resolution. More...
 
#define ACCEL15_16_BIT_RESOLUTION   16
 
#define ACCEL15_ACCEL_ENABLE_POS   2
 Accel 15 accelerometer enable position and mask. More...
 
#define ACCEL15_ACCEL_ENABLE_MSK   0x04
 
#define ACCEL15_SOFT_RESET   0x6B
 Accel 15 soft reset. More...
 
#define ACCEL15_ACCEL_ODR_MSK   0x0F
 Accel 15 accel configuration position and mask. More...
 
#define ACCEL15_ACCEL_BW_POS   4
 
#define ACCEL15_ACCEL_BW_MSK   0x70
 
#define ACCEL15_ACCEL_RANGE_MSK   0x03
 
#define ACCEL15_ACCEL_PERFMODE_POS   7
 
#define ACCEL15_ACCEL_PERFMODE_MSK   0x80
 
#define ACCEL15_ACCEL_CONFIG_LENGTH   2
 Accel 15 constants. More...
 
#define ACCEL15_FIFO_CONFIG_LENGTH   2
 
#define ACCEL15_FIFO_WM_LENGTH   2
 
#define ACCEL15_ACCEL_DATA_LENGTH   6
 
#define ACCEL15_FIFO_DATA_LENGTH   2
 
#define ACCEL15_MA_FIFO_A_X_LSB   8
 
#define ACCEL15_SENSOR_TIME_MSB_BYTE   2
 
#define ACCEL15_SENSOR_TIME_XLSB_BYTE   1
 
#define ACCEL15_SENSOR_TIME_LSB_BYTE   0
 
#define ACCEL15_FIFO_LENGTH_MSB_BYTE   1
 
#define ACCEL15_OUTPUT_DATA_RATE_0_78HZ   0x01
 Accel 15 accel ODR. More...
 
#define ACCEL15_OUTPUT_DATA_RATE_1_56HZ   0x02
 
#define ACCEL15_OUTPUT_DATA_RATE_3_12HZ   0x03
 
#define ACCEL15_OUTPUT_DATA_RATE_6_25HZ   0x04
 
#define ACCEL15_OUTPUT_DATA_RATE_12_5HZ   0x05
 
#define ACCEL15_OUTPUT_DATA_RATE_25HZ   0x06
 
#define ACCEL15_OUTPUT_DATA_RATE_50HZ   0x07
 
#define ACCEL15_OUTPUT_DATA_RATE_100HZ   0x08
 
#define ACCEL15_OUTPUT_DATA_RATE_200HZ   0x09
 
#define ACCEL15_OUTPUT_DATA_RATE_400HZ   0x0A
 
#define ACCEL15_OUTPUT_DATA_RATE_800HZ   0x0B
 
#define ACCEL15_OUTPUT_DATA_RATE_1600HZ   0x0C
 
#define ACCEL15_ACCEL_OSR4_AVG1   0
 Accel 15 accel bandwidth parameter. More...
 
#define ACCEL15_ACCEL_OSR2_AVG2   1
 
#define ACCEL15_ACCEL_NORMAL_AVG4   2
 
#define ACCEL15_ACCEL_CIC_AVG8   3
 
#define ACCEL15_ACCEL_RES_AVG16   4
 
#define ACCEL15_ACCEL_RES_AVG32   5
 
#define ACCEL15_ACCEL_RES_AVG64   6
 
#define ACCEL15_ACCEL_RES_AVG128   7
 
#define ACCEL15_ACCEL_RANGE_2G   0
 Accel 15 accel range check. More...
 
#define ACCEL15_ACCEL_RANGE_4G   1
 
#define ACCEL15_ACCEL_RANGE_8G   2
 
#define ACCEL15_ACCEL_RANGE_16G   3
 
#define ACCEL15_FATAL_ERR_MSK   0x01
 Accel 15 error status position and mask. More...
 
#define ACCEL15_CMD_ERR_POS   1
 
#define ACCEL15_CMD_ERR_MSK   0x02
 
#define ACCEL15_ERR_CODE_POS   2
 
#define ACCEL15_ERR_CODE_MSK   0x1C
 
#define ACCEL15_FIFO_ERR_POS   6
 
#define ACCEL15_FIFO_ERR_MSK   0x40
 
#define ACCEL15_FIFO_SELF_WAKE_UP_POS   1
 Accel 15 fifo self wake up position and mask. More...
 
#define ACCEL15_FIFO_SELF_WAKE_UP_MSK   0x02
 
#define ACCEL15_FIFO_BYTE_COUNTER_MSB_MSK   0x3F
 
#define ACCEL15_FIFO_DATA_POS   0
 
#define ACCEL15_FIFO_DATA_MSK   0xFF
 
#define ACCEL15_FIFO_DOWN_ACCEL_POS   4
 
#define ACCEL15_FIFO_DOWN_ACCEL_MSK   0x70
 
#define ACCEL15_FIFO_FILTER_ACCEL_POS   7
 
#define ACCEL15_FIFO_FILTER_ACCEL_MSK   0x80
 
#define ACCEL15_FIFO_HEADER_ACC   0x84
 Accel 15 fifo header data definitions. More...
 
#define ACCEL15_FIFO_HEADER_MAG   0x90
 
#define ACCEL15_FIFO_HEADER_MAG_ACC   0x94
 
#define ACCEL15_FIFO_HEADER_SENSOR_TIME   0x44
 
#define ACCEL15_FIFO_HEADER_INPUT_CONFIG   0x48
 
#define ACCEL15_FIFO_HEADER_SKIP_FRAME   0x40
 
#define ACCEL15_FIFO_HEADER_OVER_READ_MSB   0x80
 
#define ACCEL15_FIFO_HEADER_SAMPLE_DROP   0x50
 
#define ACCEL15_FIFO_MAG_ACC_ENABLE   0x60
 
#define ACCEL15_FIFO_ACC_ENABLE   0x40
 
#define ACCEL15_FIFO_MAG_ENABLE   0x20
 
#define ACCEL15_FIFO_STOP_ON_FULL   0x01
 
#define ACCEL15_FIFO_TIME   0x02
 
#define ACCEL15_FIFO_TAG_INTR2   0x04
 
#define ACCEL15_FIFO_TAG_INTR1   0x08
 
#define ACCEL15_FIFO_HEADER   0x10
 
#define ACCEL15_FIFO_MAG   0x20
 
#define ACCEL15_FIFO_ACCEL   0x40
 
#define ACCEL15_FIFO_ALL   0x7F
 
#define ACCEL15_FIFO_CONFIG_0_MASK   0x03
 
#define ACCEL15_FIFO_CONFIG_1_MASK   0xFC
 
#define ACCEL15_FIFO_LSB_CONFIG_CHECK   0x00
 Accel 15 fifo frame count definition. More...
 
#define ACCEL15_FIFO_MSB_CONFIG_CHECK   0x80
 
#define ACCEL15_FIFO_TAG_INTR_MASK   0xFC
 
#define ACCEL15_ACCEL_AUX_FIFO_DROP   0x05
 Accel 15 fifo dropped frame definition. More...
 
#define ACCEL15_ACCEL_FIFO_DROP   0x01
 
#define ACCEL15_INIT_START   0x00
 Accel 15 initialization. More...
 
#define ACCEL15_INIT_STOP   0x01
 
#define ACCEL15_SENSOR_TIME_LENGTH   3
 Accel 15 fifo sensor time length definitions. More...
 
#define ACCEL15_FIFO_ACC_LENGTH   6
 Accel 15 fifo length definition. More...
 
#define ACCEL15_FIFO_MAG_LENGTH   8
 
#define ACCEL15_FIFO_MAG_ACC_LENGTH   14
 
#define ACCEL15_CONFIG_STREAM_MESSAGE_MSK   0x0F
 
#define ACCEL15_ASIC_INITIALIZED   0x01
 
#define ACCEL15_ACCEL_CONFIG_FOC   0xB7
 Accel 15 foc related macros. More...
 
#define ACCEL15_X_AXIS   0
 Accel 15 enable/disable selections. More...
 
#define ACCEL15_Y_AXIS   1
 
#define ACCEL15_Z_AXIS   2
 
#define ACCEL15_NV_ENABLE_I2C   0x00
 Accel 15 NV_CONFIG position and mask. More...
 
#define ACCEL15_NV_DISABLE_I2C   0x01
 
#define ACCEL15_NV_ACCEL_OFFSET_POS   3
 
#define ACCEL15_NV_ACCEL_OFFSET_MSK   0x08
 
#define ACCEL15_SELFTEST_PASS   0
 Accel 15 self-test. More...
 
#define ACCEL15_SELFTEST_FAIL   1
 
#define ACCEL15_SELFTEST_DIFF_X_AXIS_FAILED   1
 
#define ACCEL15_SELFTEST_DIFF_Y_AXIS_FAILED   2
 
#define ACCEL15_SELFTEST_DIFF_Z_AXIS_FAILED   3
 
#define ACCEL15_SELFTEST_DIFF_X_AND_Y_AXIS_FAILED   4
 
#define ACCEL15_SELFTEST_DIFF_X_AND_Z_AXIS_FAILED   5
 
#define ACCEL15_SELFTEST_DIFF_Y_AND_Z_AXIS_FAILED   6
 
#define ACCEL15_SELFTEST_DIFF_X_Y_AND_Z_AXIS_FAILED   7
 
#define ACCEL15_ACCEL_SELFTEST_ENABLE_MSK   0x01
 Accel 15 self-test position and mask. More...
 
#define ACCEL15_ACCEL_SELFTEST_SIGN_POS   2
 
#define ACCEL15_ACCEL_SELFTEST_SIGN_MSK   0x04
 
#define ACCEL15_SELFTEST_AMP_POS   3
 
#define ACCEL15_SELFTEST_AMP_MSK   0x08
 
#define ACCEL15_MAX_VALUE_FIFO_FILTER   1
 Accel 15 condition check for reading and wrting data. More...
 
#define ACCEL15_MAX_VALUE_SPI3   1
 
#define ACCEL15_MAX_VALUE_SELFTEST_AMP   1
 
#define ACCEL15_MAX_IF_MODE   3
 
#define ACCEL15_MAX_VALUE_SELFTEST_SIGN   1
 
#define ACCEL15_FOC_ACC_CONF_VAL   0xB7
 Accel 15 Macro to define accelerometer configuration value for FOC. More...
 
#define ACCEL15_SPI_WRITE   0x00
 Accel 15 SPI write/read command. More...
 
#define ACCEL15_SPI_READ   0x80
 
#define ACCEL15_SET_DEV_ADDR_GND   0x18
 Accel 15 device address setting. More...
 
#define ACCEL15_SET_DEV_ADDR_VCC   0x19
 
#define ACCEL15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Typedefs

typedef err_t(* accel15_master_io_t) (struct accel15_s *, uint8_t, uint8_t *, uint8_t)
 Accel 15 Click driver interface. More...
 
typedef struct accel15_s accel15_t
 Accel 15 Click context object. More...
 

Enumerations

enum  accel15_drv_t { ACCEL15_DRV_SEL_SPI, ACCEL15_DRV_SEL_I2C }
 Accel 15 Click driver selector. More...
 

Functions

void accel15_cfg_setup (accel15_cfg_t *cfg)
 Accel 15 configuration object setup function. More...
 
void accel15_drv_interface_selection (accel15_cfg_t *cfg, accel15_drv_t drv_sel)
 Accel 15 driver interface setup function. More...
 
err_t accel15_init (accel15_t *ctx, accel15_cfg_t *cfg)
 Accel 15 initialization function. More...
 
void accel15_default_cfg (accel15_t *ctx)
 Accel 15 default configuration function. More...
 
err_t accel15_generic_write (accel15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 15 data writing function. More...
 
err_t accel15_generic_read (accel15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 15 data reading function. More...
 
void accel15_soft_reset (accel15_t *ctx)
 Accel 15 soft reset function. More...
 
err_t accel15_check_id (accel15_t *ctx)
 Accel 15 check ID function. More...
 
uint8_t accel15_get_error (accel15_t *ctx)
 Accel 15 get error function. More...
 
uint8_t accel15_get_status (accel15_t *ctx)
 Accel 15 status function. More...
 
void accel15_enable_accel (accel15_t *ctx)
 Accel 15 enable accel function. More...
 
void accel15_cfg_accel (accel15_t *ctx, uint8_t acc_odr, uint8_t g_range)
 Accel 15 config accel function. More...
 
uint8_t accel15_get_internal_status (accel15_t *ctx)
 Accel 15 internal status function. More...
 
void accel15_get_axis_data (accel15_t *ctx, accel15_axis_t *axis)
 Accel 15 get accelerometer axis function. More...
 
uint8_t accel15_get_int_1 (accel15_t *ctx)
 Accel 15 get Interrupt 1 function. More...
 
uint8_t accel15_get_int_2 (accel15_t *ctx)
 Accel 15 get Interrupt 1 function. More...
 

Detailed Description

This file contains API for Accel 15 Click Driver.

Typedef Documentation

◆ accel15_master_io_t

typedef err_t( * accel15_master_io_t) (struct accel15_s *, uint8_t, uint8_t *, uint8_t)

Accel 15 Click driver interface.

Definition of driver interface of Accel 15 Click driver. Driver serial interface.

◆ accel15_t

typedef struct accel15_s accel15_t

Accel 15 Click context object.

Context object definition of Accel 15 Click driver.

Enumeration Type Documentation

◆ accel15_drv_t

Accel 15 Click driver selector.

Selects target driver interface of Accel 15 Click driver.

Enumerator
ACCEL15_DRV_SEL_SPI 

SPI driver descriptor.

ACCEL15_DRV_SEL_I2C 

I2C driver descriptor.