accel29 2.1.0.0
accel29.h File Reference

This file contains API for Accel 29 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  accel29_s
 Accel 29 Click context object. More...
 
struct  accel29_cfg_t
 Accel 29 Click configuration object. More...
 
struct  accel29_axes_t
 Accel 29 Click Axes data structure. More...
 

Macros

#define ACCEL29_REG_DEVID   0x00
 Accel 29 register map.
 
#define ACCEL29_REG_OFSX   0x1E
 
#define ACCEL29_REG_OFSY   0x1F
 
#define ACCEL29_REG_OFSZ   0x20
 
#define ACCEL29_REG_THRESH_ACT   0x24
 
#define ACCEL29_REG_THRESH_INACT   0x25
 
#define ACCEL29_REG_TIME_INACT   0x26
 
#define ACCEL29_REG_ACT_INACT_CTL   0x27
 
#define ACCEL29_REG_BW_RATE   0x2C
 
#define ACCEL29_REG_POWER_CTL   0x2D
 
#define ACCEL29_REG_INT_ENABLE   0x2E
 
#define ACCEL29_REG_INT_MAP   0x2F
 
#define ACCEL29_REG_INT_SOURCE   0x30
 
#define ACCEL29_REG_DATA_FORMAT   0x31
 
#define ACCEL29_REG_DATA_X0   0x32
 
#define ACCEL29_REG_DATA_X1   0x33
 
#define ACCEL29_REG_DATA_Y0   0x34
 
#define ACCEL29_REG_DATA_Y1   0x35
 
#define ACCEL29_REG_DATA_Z0   0x36
 
#define ACCEL29_REG_DATA_Z1   0x37
 
#define ACCEL29_REG_FIFO_CTL   0x38
 
#define ACCEL29_REG_FIFO_STATUS   0x39
 
#define ACCEL29_INT_ENABLE_DATA_READY   0x80
 Accel 29 INT_ENABLE register setting.
 
#define ACCEL29_INT_ENABLE_ACTIVITY   0x10
 
#define ACCEL29_INT_ENABLE_INACTIVITY   0x08
 
#define ACCEL29_INT_ENABLE_OVERRUN   0x01
 
#define ACCEL29_INT_MAP_DATA_READY_INT2   0x80
 Accel 29 INT_MAP register setting.
 
#define ACCEL29_INT_MAP_DATA_READY_INT1   0x00
 
#define ACCEL29_INT_MAP_DATA_READY_MASK   0x80
 
#define ACCEL29_INT_MAP_ACTIVITY_INT2   0x10
 
#define ACCEL29_INT_MAP_ACTIVITY_INT1   0x00
 
#define ACCEL29_INT_MAP_ACTIVITY_MASK   0x10
 
#define ACCEL29_INT_MAP_INACTIVITY_INT2   0x08
 
#define ACCEL29_INT_MAP_INACTIVITY_INT1   0x00
 
#define ACCEL29_INT_MAP_INACTIVITY_MASK   0x08
 
#define ACCEL29_INT_MAP_OVERRUN_INT2   0x01
 
#define ACCEL29_INT_MAP_OVERRUN_INT1   0x00
 
#define ACCEL29_INT_MAP_OVERRUN_MASK   0x01
 
#define ACCEL29_INT_SOURCE_DATA_READY   0x80
 Accel 29 INT_SOURCE register setting.
 
#define ACCEL29_INT_SOURCE_ACTIVITY   0x10
 
#define ACCEL29_INT_SOURCE_INACTIVITY   0x08
 
#define ACCEL29_INT_SOURCE_OVERRUN   0x01
 
#define ACCEL29_BW_RATE_LOW_POWER   0x10
 Accel 29 BW_RATE register setting.
 
#define ACCEL29_BW_RATE_6_25_HZ   0x06
 
#define ACCEL29_BW_RATE_12_5_HZ   0x07
 
#define ACCEL29_BW_RATE_25_HZ   0x08
 
#define ACCEL29_BW_RATE_50_HZ   0x09
 
#define ACCEL29_BW_RATE_100_HZ   0x0A
 
#define ACCEL29_BW_RATE_200_HZ   0x0B
 
#define ACCEL29_BW_RATE_400_HZ   0x0C
 
#define ACCEL29_BW_RATE_800_HZ   0x0D
 
#define ACCEL29_BW_RATE_1600_HZ   0x0E
 
#define ACCEL29_BW_RATE_3200_HZ   0x0F
 
#define ACCEL29_POWER_CTL_LINK   0x20
 Accel 29 POWER_CTL register setting.
 
#define ACCEL29_POWER_CTL_AUTO_SLEEP   0x10
 
#define ACCEL29_POWER_CTL_MEASURE   0x08
 
#define ACCEL29_POWER_CTL_SLEEP   0x04
 
#define ACCEL29_POWER_CTL_WAKEUP_8_HZ   0x00
 
#define ACCEL29_POWER_CTL_WAKEUP_4_HZ   0x01
 
#define ACCEL29_POWER_CTL_WAKEUP_2_HZ   0x02
 
#define ACCEL29_POWER_CTL_WAKEUP_1_HZ   0x03
 
#define ACCEL29_POWER_CTL_WAKEUP_MASK   0x03
 
#define ACCEL29_DEVID   0xE5
 Accel 29 device ID setting.
 
#define ACCEL29_OFS_RESET   0
 Accel 29 offset settings.
 
#define ACCEL29_OFS_SCALE_FACTOR_G_PER_LSB   0.195f
 
#define ACCEL29_SCALE_FACTOR_LSB_PER_G   20.48f
 Accel 29 data resolution settings.
 
#define ACCEL29_NUM_OF_SAMPLES   100
 Accel 29 number of data samples for averaging.
 
#define ACCEL29_SPI_RW_BIT   0x80
 Accel 29 communication frame setting.
 
#define ACCEL29_SPI_MB_BIT   0x40
 
#define ACCEL29_ADDRESS_MASK   0x3F
 
#define ACCEL29_DEVICE_ADDRESS_0   0x53
 Accel 29 device address setting.
 
#define ACCEL29_DEVICE_ADDRESS_1   0x1D
 
#define ACCEL29_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ACCEL29_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ACCEL29_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* accel29_master_io_t) (struct accel29_s *, uint8_t, uint8_t *, uint8_t)
 Accel 29 Click driver interface.
 
typedef struct accel29_s accel29_t
 Accel 29 Click context object.
 

Enumerations

enum  accel29_drv_t { ACCEL29_DRV_SEL_SPI , ACCEL29_DRV_SEL_I2C }
 Accel 29 Click driver selector. More...
 
enum  accel29_return_value_t { ACCEL29_OK = 0 , ACCEL29_ERROR = -1 }
 Accel 29 Click return value data. More...
 

Functions

void accel29_cfg_setup (accel29_cfg_t *cfg)
 Accel 29 configuration object setup function.
 
void accel29_drv_interface_selection (accel29_cfg_t *cfg, accel29_drv_t drv_sel)
 Accel 29 driver interface setup function.
 
err_t accel29_init (accel29_t *ctx, accel29_cfg_t *cfg)
 Accel 29 initialization function.
 
err_t accel29_default_cfg (accel29_t *ctx)
 Accel 29 default configuration function.
 
err_t accel29_generic_write (accel29_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 29 data writing function.
 
err_t accel29_generic_read (accel29_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 29 data reading function.
 
err_t accel29_write_register (accel29_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 29 write register function.
 
err_t accel29_read_register (accel29_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 29 read register function.
 
err_t accel29_check_communication (accel29_t *ctx)
 Accel 29 check communication function.
 
uint8_t accel29_get_int1_pin (accel29_t *ctx)
 Accel 29 get int1 pin function.
 
uint8_t accel29_get_int2_pin (accel29_t *ctx)
 Accel 29 get int2 pin function.
 
err_t accel29_get_axes (accel29_t *ctx, accel29_axes_t *axes)
 Accel 29 get axes function.
 
err_t accel29_get_avg_axes (accel29_t *ctx, uint16_t num_samples, accel29_axes_t *avg_axes)
 Accel 29 get avg axes function.
 
err_t accel29_calibrate_offset (accel29_t *ctx, accel29_axes_t calib_axes)
 Accel 29 calibrate offset function.
 

Detailed Description

This file contains API for Accel 29 Click Driver.

Typedef Documentation

◆ accel29_master_io_t

typedef err_t(* accel29_master_io_t) (struct accel29_s *, uint8_t, uint8_t *, uint8_t)

Accel 29 Click driver interface.

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

◆ accel29_t

typedef struct accel29_s accel29_t

Accel 29 Click context object.

Context object definition of Accel 29 Click driver.

Enumeration Type Documentation

◆ accel29_drv_t

Accel 29 Click driver selector.

Selects target driver interface of Accel 29 Click driver.

Enumerator
ACCEL29_DRV_SEL_SPI 

SPI driver descriptor.

ACCEL29_DRV_SEL_I2C 

I2C driver descriptor.

◆ accel29_return_value_t

Accel 29 Click return value data.

Predefined enum values for driver return values.

Enumerator
ACCEL29_OK 
ACCEL29_ERROR