accel27 2.1.0.0
accel27.h File Reference

This file contains API for Accel 27 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  accel27_s
 Accel 27 Click context object. More...
 
struct  accel27_cfg_t
 Accel 27 Click configuration object. More...
 
struct  accel27_axes_t
 Accel 27 Click Axes data structure. More...
 

Macros

#define ACCEL27_REG_DEVID_AD   0x00
 Accel 27 register map.
 
#define ACCEL27_REG_DEVID_MST   0x01
 
#define ACCEL27_REG_PARTID   0x02
 
#define ACCEL27_REG_REVID   0x03
 
#define ACCEL27_REG_STATUS   0x04
 
#define ACCEL27_REG_STATUS2   0x05
 
#define ACCEL27_REG_FIFO_ENTRIES2   0x06
 
#define ACCEL27_REG_FIFO_ENTRIES   0x07
 
#define ACCEL27_REG_XDATA_H   0x08
 
#define ACCEL27_REG_XDATA_L   0x09
 
#define ACCEL27_REG_YDATA_H   0x0A
 
#define ACCEL27_REG_YDATA_L   0x0B
 
#define ACCEL27_REG_ZDATA_H   0x0C
 
#define ACCEL27_REG_ZDATA_L   0x0D
 
#define ACCEL27_REG_MAXPEAK_X_H   0x15
 
#define ACCEL27_REG_MAXPEAK_X_L   0x16
 
#define ACCEL27_REG_MAXPEAK_Y_H   0x17
 
#define ACCEL27_REG_MAXPEAK_Y_L   0x18
 
#define ACCEL27_REG_MAXPEAK_Z_H   0x19
 
#define ACCEL27_REG_MAXPEAK_Z_L   0x1A
 
#define ACCEL27_REG_OFFSET_X   0x20
 
#define ACCEL27_REG_OFFSET_Y   0x21
 
#define ACCEL27_REG_OFFSET_Z   0x22
 
#define ACCEL27_REG_THRESH_ACT_X_H   0x23
 
#define ACCEL27_REG_THRESH_ACT_X_L   0x24
 
#define ACCEL27_REG_THRESH_ACT_Y_H   0x25
 
#define ACCEL27_REG_THRESH_ACT_Y_L   0x26
 
#define ACCEL27_REG_THRESH_ACT_Z_H   0x27
 
#define ACCEL27_REG_THRESH_ACT_Z_L   0x28
 
#define ACCEL27_REG_TIME_ACT   0x29
 
#define ACCEL27_REG_THRESH_INACT_X_H   0x2A
 
#define ACCEL27_REG_THRESH_INACT_X_L   0x2B
 
#define ACCEL27_REG_THRESH_INACT_Y_H   0x2C
 
#define ACCEL27_REG_THRESH_INACT_Y_L   0x2D
 
#define ACCEL27_REG_THRESH_INACT_Z_H   0x2E
 
#define ACCEL27_REG_THRESH_INACT_Z_L   0x2F
 
#define ACCEL27_REG_TIME_INACT_H   0x30
 
#define ACCEL27_REG_TIME_INACT_L   0x31
 
#define ACCEL27_REG_THRESH_ACT2_X_H   0x32
 
#define ACCEL27_REG_THRESH_ACT2_X_L   0x33
 
#define ACCEL27_REG_THRESH_ACT2_Y_H   0x34
 
#define ACCEL27_REG_THRESH_ACT2_Y_L   0x35
 
#define ACCEL27_REG_THRESH_ACT2_Z_H   0x36
 
#define ACCEL27_REG_THRESH_ACT2_Z_L   0x37
 
#define ACCEL27_REG_HPF   0x38
 
#define ACCEL27_REG_FIFO_SAMPLES   0x39
 
#define ACCEL27_REG_FIFO_CTL   0x3A
 
#define ACCEL27_REG_INT1_MAP   0x3B
 
#define ACCEL27_REG_INT2_MAP   0x3C
 
#define ACCEL27_REG_TIMING   0x3D
 
#define ACCEL27_REG_MEASURE   0x3E
 
#define ACCEL27_REG_POWER_CTL   0x3F
 
#define ACCEL27_REG_SELF_TEST   0x40
 
#define ACCEL27_REG_RESET   0x41
 
#define ACCEL27_REG_FIFO_DATA   0x42
 
#define ACCEL27_INT_MAP_INT_LOW   0x80
 Accel 27 INT_MAP register settings.
 
#define ACCEL27_INT_MAP_AWAKE   0x40
 
#define ACCEL27_INT_MAP_ACT   0x20
 
#define ACCEL27_INT_MAP_INACT   0x10
 
#define ACCEL27_INT_MAP_DATA_RDY   0x01
 
#define ACCEL27_TIMING_ODR_320HZ   0x00
 Accel 27 TIMING register settings.
 
#define ACCEL27_TIMING_ODR_640HZ   0x20
 
#define ACCEL27_TIMING_ODR_1280HZ   0x40
 
#define ACCEL27_TIMING_ODR_25600HZ   0x60
 
#define ACCEL27_TIMING_ODR_5120HZ   0x80
 
#define ACCEL27_TIMING_ODR_MASK   0xE0
 
#define ACCEL27_TIMING_WAKEUP_RATE_65_MS   0x00
 
#define ACCEL27_TIMING_WAKEUP_RATE_130_MS   0x04
 
#define ACCEL27_TIMING_WAKEUP_RATE_260_MS   0x08
 
#define ACCEL27_TIMING_WAKEUP_RATE_640_MS   0x0C
 
#define ACCEL27_TIMING_WAKEUP_RATE_2560_MS   0x10
 
#define ACCEL27_TIMING_WAKEUP_RATE_5120_MS   0x14
 
#define ACCEL27_TIMING_WAKEUP_RATE_10240_MS   0x18
 
#define ACCEL27_TIMING_WAKEUP_RATE_30720_MS   0x1C
 
#define ACCEL27_TIMING_WAKEUP_RATE_MASK   0x1C
 
#define ACCEL27_TIMING_EXT_CLK   0x02
 
#define ACCEL27_TIMING_EXT_SYNC   0x01
 
#define ACCEL27_POWER_CTL_I2C_HSM_EN   0x80
 Accel 27 POWER_CTL register settings.
 
#define ACCEL27_POWER_CTL_INSTANT_ON_THRESH   0x20
 
#define ACCEL27_POWER_CTL_FLT_SETL_462_5_MS   0x00
 
#define ACCEL27_POWER_CTL_FLT_SETL_4_OF_ODR   0x10
 
#define ACCEL27_POWER_CTL_FLT_SETL_MASK   0x10
 
#define ACCEL27_POWER_CTL_LPF_DISABLE   0x08
 
#define ACCEL27_POWER_CTL_HPF_DISABLE   0x04
 
#define ACCEL27_POWER_CTL_MODE_STANDBY   0x00
 
#define ACCEL27_POWER_CTL_MODE_WAKE_UP   0x01
 
#define ACCEL27_POWER_CTL_MODE_INSTANT_ON   0x02
 
#define ACCEL27_POWER_CTL_MODE_MEASUREMENT   0x03
 
#define ACCEL27_POWER_CTL_MODE_MASK   0x03
 
#define ACCEL27_RESET   0x52
 Accel 27 RESET register settings.
 
#define ACCEL27_DEVID_AD   0xAD
 Accel 27 device ID setting.
 
#define ACCEL27_DEVID_MST   0x1D
 
#define ACCEL27_DEVID_PRODUCT   0xFA
 
#define ACCEL27_SCALE_FACTOR_LSB_PER_G   5.0f
 Accel 27 data resolution settings.
 
#define ACCEL27_DEVICE_ADDRESS_0   0x1D
 Accel 27 device address setting.
 
#define ACCEL27_DEVICE_ADDRESS_1   0x53
 
#define ACCEL27_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ACCEL27_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ACCEL27_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* accel27_master_io_t) (struct accel27_s *, uint8_t, uint8_t *, uint8_t)
 Accel 27 Click driver interface.
 
typedef struct accel27_s accel27_t
 Accel 27 Click context object.
 

Enumerations

enum  accel27_drv_t { ACCEL27_DRV_SEL_SPI , ACCEL27_DRV_SEL_I2C }
 Accel 27 Click driver selector. More...
 
enum  accel27_return_value_t { ACCEL27_OK = 0 , ACCEL27_ERROR = -1 }
 Accel 27 Click return value data. More...
 

Functions

void accel27_cfg_setup (accel27_cfg_t *cfg)
 Accel 27 configuration object setup function.
 
void accel27_drv_interface_selection (accel27_cfg_t *cfg, accel27_drv_t drv_sel)
 Accel 27 driver interface setup function.
 
err_t accel27_init (accel27_t *ctx, accel27_cfg_t *cfg)
 Accel 27 initialization function.
 
err_t accel27_default_cfg (accel27_t *ctx)
 Accel 27 default configuration function.
 
err_t accel27_generic_write (accel27_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 27 data writing function.
 
err_t accel27_generic_read (accel27_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 27 data reading function.
 
err_t accel27_write_register (accel27_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 27 write register function.
 
err_t accel27_read_register (accel27_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 27 read register function.
 
err_t accel27_check_communication (accel27_t *ctx)
 Accel 27 check communication function.
 
uint8_t accel27_get_int1_pin (accel27_t *ctx)
 Accel 27 get int1 pin function.
 
uint8_t accel27_get_int2_pin (accel27_t *ctx)
 Accel 27 get int2 pin function.
 
err_t accel27_get_axes (accel27_t *ctx, accel27_axes_t *axes)
 Accel 27 get axes function.
 
err_t accel27_reset_device (accel27_t *ctx)
 Accel 27 reset device function.
 

Detailed Description

This file contains API for Accel 27 Click Driver.

Typedef Documentation

◆ accel27_master_io_t

typedef err_t(* accel27_master_io_t) (struct accel27_s *, uint8_t, uint8_t *, uint8_t)

Accel 27 Click driver interface.

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

◆ accel27_t

typedef struct accel27_s accel27_t

Accel 27 Click context object.

Context object definition of Accel 27 Click driver.

Enumeration Type Documentation

◆ accel27_drv_t

Accel 27 Click driver selector.

Selects target driver interface of Accel 27 Click driver.

Enumerator
ACCEL27_DRV_SEL_SPI 

SPI driver descriptor.

ACCEL27_DRV_SEL_I2C 

I2C driver descriptor.

◆ accel27_return_value_t

Accel 27 Click return value data.

Predefined enum values for driver return values.

Enumerator
ACCEL27_OK 
ACCEL27_ERROR