accel30 2.1.0.0
accel30.h File Reference

This file contains API for Accel 30 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  accel30_s
 Accel 30 Click context object. More...
 
struct  accel30_cfg_t
 Accel 30 Click configuration object. More...
 
struct  accel30_axis_t
 Accel 30 Click Axis structure object. More...
 
struct  accel30_avg_axis_t
 Accel 30 Click Axis averaged structure object. More...
 

Macros

#define ACCEL30_REG_EXT_STAT_1   0x00
 Accel 30 description register.
 
#define ACCEL30_REG_EXT_STAT_2   0x01
 
#define ACCEL30_REG_XOUT_LSB   0x02
 
#define ACCEL30_REG_XOUT_MSB   0x03
 
#define ACCEL30_REG_YOUT_LSB   0x04
 
#define ACCEL30_REG_YOUT_MSB   0x05
 
#define ACCEL30_REG_ZOUT_LSB   0x06
 
#define ACCEL30_REG_ZOUT_MSB   0x07
 
#define ACCEL30_REG_STATUS_1   0x08
 
#define ACCEL30_REG_STATUS_2   0x09
 
#define ACCEL30_REG_FREG_1   0x0D
 
#define ACCEL30_REG_FREG_2   0x0E
 
#define ACCEL30_REG_INIT_1   0x0F
 
#define ACCEL30_REG_MODE_C   0x10
 
#define ACCEL30_REG_WAKE_C   0x11
 
#define ACCEL30_REG_SNIFF_C   0x12
 
#define ACCEL30_REG_SNIFFTH_C   0x13
 
#define ACCEL30_REG_SNIFFCF_C   0x14
 
#define ACCEL30_REG_RANGE_C   0x15
 
#define ACCEL30_REG_FIFO_C   0x16
 
#define ACCEL30_REG_INTR_C   0x17
 
#define ACCEL30_REG_INIT_3   0x1A
 
#define ACCEL30_REG_SCRATCH   0x1B
 
#define ACCEL30_REG_POWER_MODE   0x1C
 
#define ACCEL30_REG_DMX   0x20
 
#define ACCEL30_REG_DMY   0x21
 
#define ACCEL30_REG_DMZ   0x22
 
#define ACCEL30_REG_RESET   0x24
 
#define ACCEL30_REG_INIT_2   0x28
 
#define ACCEL30_REG_TRIGC   0x29
 
#define ACCEL30_REG_XOFFL   0x2A
 
#define ACCEL30_REG_XOFFH   0x2B
 
#define ACCEL30_REG_YOFFL   0x2C
 
#define ACCEL30_REG_YOFFH   0x2D
 
#define ACCEL30_REG_ZOFFL   0x2E
 
#define ACCEL30_REG_ZOFFH   0x2F
 
#define ACCEL30_REG_XGAIN   0x30
 
#define ACCEL30_REG_YGAIN   0x31
 
#define ACCEL30_REG_ZGAIN   0x32
 
#define ACCEL30_REG_OPT   0x3B
 
#define ACCEL30_REG_GAIN   0x21
 
#define ACCEL30_MODE_BIT_MASK   0xF0
 Accel 30 description setting.
 
#define ACCEL30_RANGE_BIT_MASK   0x07
 
#define ACCEL30_GAIN_BIT_MASK   0x3F
 
#define ACCEL30_RESOLUTION_BIT_MASK   0x70
 
#define ACCEL30_DMX_PN_DISABLE   0x00
 
#define ACCEL30_DMX_RES_BIT_MASK   0x01
 
#define ACCEL30_ENABLE_XYZ_AXIS_PD   0x00
 
#define ACCEL30_TRIG_CMD_CONTINUOUS   0x00
 
#define ACCEL30_TRIG_CMD_ONE_SHOT   0x01
 
#define ACCEL30_FORCE_RESET   0x40
 
#define ACCEL30_I2C_ENABLE   0x40
 
#define ACCEL30_SPI_ENABLE   0x80
 
#define ACCEL30_MODE_BIT_MASK   0xF0
 Accel 30 description setting.
 
#define ACCEL30_DEVICE_ADDRESS_GND   0x4C
 Accel 30 device address setting.
 
#define ACCEL30_DEVICE_ADDRESS_VCC   0x6C
 
#define ACCEL30_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ACCEL30_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ACCEL30_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* accel30_master_io_t) (struct accel30_s *, uint8_t, uint8_t *, uint8_t)
 Accel 30 Click driver interface.
 
typedef struct accel30_s accel30_t
 Accel 30 Click context object.
 

Enumerations

enum  accel30_drv_t { ACCEL30_DRV_SEL_SPI , ACCEL30_DRV_SEL_I2C }
 Accel 30 Click driver selector. More...
 
enum  accel30_return_value_t { ACCEL30_OK = 0 , ACCEL30_ERROR = -1 }
 Accel 30 Click return value data. More...
 
enum  accel30_gain_t { ACCEL30_GAIN_DEFAULT = 0 , ACCEL30_GAIN_4X , ACCEL30_GAIN_1X , ACCEL30_GAIN_NOT_USED }
 Accel 30 Click gain value data. More...
 
enum  accel30_op_mode_t {
  ACCEL30_MODE_SLEEP = 0 , ACCEL30_MODE_STANDBY = 1 , ACCEL30_MODE_SNIFF = 2 , ACCEL30_MODE_CWAKE = 5 ,
  ACCEL30_MODE_TRIG = 7
}
 Accel 30 Click operating mode value data. More...
 
enum  accel30_range_t {
  ACCEL30_RANGE_2G = 0 , ACCEL30_RANGE_4G , ACCEL30_RANGE_8G , ACCEL30_RANGE_12G ,
  ACCEL30_RANGE_16G , ACCEL30_RANGE_END
}
 Accel 30 Click range value data. More...
 
enum  accel30_resolution_t {
  ACCEL30_RESOLUTION_6BIT = 0 , ACCEL30_RESOLUTION_7BIT , ACCEL30_RESOLUTION_8BIT , ACCEL30_RESOLUTION_10BIT ,
  ACCEL30_RESOLUTION_12BIT , ACCEL30_RESOLUTION_14BIT , ACCEL30_RESOLUTION_END
}
 Accel 30 Click resolution value data. More...
 
enum  accel30_cwake_t {
  ACCEL30_CWAKE_DEFAULT_50Hz = 0 , ACCEL30_CWAKE_0p4Hz , ACCEL30_CWAKE_0p8Hz , ACCEL30_CWAKE_2Hz ,
  ACCEL30_CWAKE_6Hz , ACCEL30_CWAKE_14Hz , ACCEL30_CWAKE_28Hz , ACCEL30_CWAKE_54Hz ,
  ACCEL30_CWAKE_100Hz , ACCEL30_CWAKE_210Hz , ACCEL30_CWAKE_400Hz , ACCEL30_CWAKE_600Hz ,
  ACCEL30_CWAKE_RESER0 , ACCEL30_CWAKE_RESER1 , ACCEL30_CWAKE_RESER2 , ACCEL30_CWAKE_750Hz ,
  ACCEL30_CWAKE_END
}
 Accel 30 Click CWAKE sampling value data. More...
 
enum  accel30_sniff_sr_t {
  ACCEL30_SNIFF_SR_DEFAULT_6Hz = 0 , ACCEL30_SNIFF_SR_0p4Hz , ACCEL30_SNIFF_SR_0p8Hz , ACCEL30_SNIFF_SR_2Hz ,
  ACCEL30_SNIFF_SR_6Hz , ACCEL30_SNIFF_SR_13Hz , ACCEL30_SNIFF_SR_25Hz , ACCEL30_SNIFF_SR_50Hz ,
  ACCEL30_SNIFF_SR_100Hz , ACCEL30_SNIFF_SR_200Hz , ACCEL30_SNIFF_SR_400Hz , ACCEL30_SNIFF_SR_END
}
 Accel 30 Click SNIFF sampling value data. More...
 
enum  accel30_fifo_mode_t { ACCEL30_FIFO_MODE_NORMAL = 0 , ACCEL30_FIFO_MODE_WATERMARK , ACCEL30_FIFO_MODE_END }
 Accel 30 Click FIFO mode value data. More...
 
enum  accel30_power_mode_t {
  ACCEL30_LOW_POWER = 0 , ACCEL30_RESERVED_1 , ACCEL30_RESERVED_2 , ACCEL30_ULOW_POWER ,
  ACCEL30_PRE_POWER
}
 Accel 30 Click power mode value data. More...
 

Functions

void accel30_cfg_setup (accel30_cfg_t *cfg)
 Accel 30 configuration object setup function.
 
void accel30_drv_interface_selection (accel30_cfg_t *cfg, accel30_drv_t drv_sel)
 Accel 30 driver interface setup function.
 
err_t accel30_init (accel30_t *ctx, accel30_cfg_t *cfg)
 Accel 30 initialization function.
 
err_t accel30_default_cfg (accel30_t *ctx)
 Accel 30 default configuration function.
 
err_t accel30_generic_write (accel30_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 30 data writing function.
 
err_t accel30_generic_read (accel30_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 30 data reading function.
 
err_t accel30_set_mode (accel30_t *ctx, accel30_op_mode_t mode)
 Accel 30 set operating mode function.
 
err_t accel30_set_range_ctrl (accel30_t *ctx, accel30_range_t range)
 Accel 30 set range control function.
 
err_t accel30_soft_reset (accel30_t *ctx)
 Accel 30 soft reset function.
 
err_t accel30_set_sniff_gain (accel30_t *ctx, accel30_gain_t gain)
 Accel 30 set sniff gain function.
 
err_t accel30_set_wake_gain (accel30_t *ctx, accel30_gain_t gain)
 Accel 30 set wake gain function.
 
err_t accel30_set_resolution_ctrl (accel30_t *ctx, accel30_resolution_t resolution)
 Accel 30 set resolution control function.
 
err_t accel30_set_sample_rate (accel30_t *ctx, accel30_cwake_t sample_rate)
 Accel 30 set sampling rate function.
 
err_t accel30_set_sniff_sample_rate (accel30_t *ctx, accel30_sniff_sr_t sample_rate)
 Accel 30 set sniff sampling rate function.
 
err_t accel30_set_pwr_mode (accel30_t *ctx, accel30_power_mode_t pwr_mode)
 Accel 30 set power mode function.
 
err_t accel30_get_axis (accel30_t *ctx, accel30_axis_t *acc_axis)
 Accel 30 get accel data function.
 
err_t accel30_get_avg_axes (accel30_t *ctx, accel30_avg_axis_t *acc_avg_axis)
 Accel 30 get accel averaged data function.
 
uint8_t accel30_get_int_pin (accel30_t *ctx)
 Accel 30 get interrupt function.
 

Detailed Description

This file contains API for Accel 30 Click Driver.

Typedef Documentation

◆ accel30_master_io_t

typedef err_t(* accel30_master_io_t) (struct accel30_s *, uint8_t, uint8_t *, uint8_t)

Accel 30 Click driver interface.

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

◆ accel30_t

typedef struct accel30_s accel30_t

Accel 30 Click context object.

Context object definition of Accel 30 Click driver.

Enumeration Type Documentation

◆ accel30_cwake_t

Accel 30 Click CWAKE sampling value data.

Predefined enum values for driver CWAKE sampling values.

Enumerator
ACCEL30_CWAKE_DEFAULT_50Hz 
ACCEL30_CWAKE_0p4Hz 
ACCEL30_CWAKE_0p8Hz 
ACCEL30_CWAKE_2Hz 
ACCEL30_CWAKE_6Hz 
ACCEL30_CWAKE_14Hz 
ACCEL30_CWAKE_28Hz 
ACCEL30_CWAKE_54Hz 
ACCEL30_CWAKE_100Hz 
ACCEL30_CWAKE_210Hz 
ACCEL30_CWAKE_400Hz 
ACCEL30_CWAKE_600Hz 
ACCEL30_CWAKE_RESER0 
ACCEL30_CWAKE_RESER1 
ACCEL30_CWAKE_RESER2 
ACCEL30_CWAKE_750Hz 
ACCEL30_CWAKE_END 

◆ accel30_drv_t

Accel 30 Click driver selector.

Selects target driver interface of Accel 30 Click driver.

Enumerator
ACCEL30_DRV_SEL_SPI 

SPI driver descriptor.

ACCEL30_DRV_SEL_I2C 

I2C driver descriptor.

◆ accel30_fifo_mode_t

Accel 30 Click FIFO mode value data.

Predefined enum values for driver FIFO mode values.

Enumerator
ACCEL30_FIFO_MODE_NORMAL 
ACCEL30_FIFO_MODE_WATERMARK 
ACCEL30_FIFO_MODE_END 

◆ accel30_gain_t

Accel 30 Click gain value data.

Predefined enum values for driver gain values.

Enumerator
ACCEL30_GAIN_DEFAULT 
ACCEL30_GAIN_4X 
ACCEL30_GAIN_1X 
ACCEL30_GAIN_NOT_USED 

◆ accel30_op_mode_t

Accel 30 Click operating mode value data.

Predefined enum values for driver mode values.

Enumerator
ACCEL30_MODE_SLEEP 
ACCEL30_MODE_STANDBY 
ACCEL30_MODE_SNIFF 
ACCEL30_MODE_CWAKE 
ACCEL30_MODE_TRIG 

◆ accel30_power_mode_t

Accel 30 Click power mode value data.

Predefined enum values for driver power mode values.

Enumerator
ACCEL30_LOW_POWER 
ACCEL30_RESERVED_1 
ACCEL30_RESERVED_2 
ACCEL30_ULOW_POWER 
ACCEL30_PRE_POWER 

◆ accel30_range_t

Accel 30 Click range value data.

Predefined enum values for driver range values.

Enumerator
ACCEL30_RANGE_2G 
ACCEL30_RANGE_4G 
ACCEL30_RANGE_8G 
ACCEL30_RANGE_12G 
ACCEL30_RANGE_16G 
ACCEL30_RANGE_END 

◆ accel30_resolution_t

Accel 30 Click resolution value data.

Predefined enum values for driver resolution values.

Enumerator
ACCEL30_RESOLUTION_6BIT 
ACCEL30_RESOLUTION_7BIT 
ACCEL30_RESOLUTION_8BIT 
ACCEL30_RESOLUTION_10BIT 
ACCEL30_RESOLUTION_12BIT 
ACCEL30_RESOLUTION_14BIT 
ACCEL30_RESOLUTION_END 

◆ accel30_return_value_t

Accel 30 Click return value data.

Predefined enum values for driver return values.

Enumerator
ACCEL30_OK 
ACCEL30_ERROR 

◆ accel30_sniff_sr_t

Accel 30 Click SNIFF sampling value data.

Predefined enum values for driver SNIFF sampling values.

Enumerator
ACCEL30_SNIFF_SR_DEFAULT_6Hz 
ACCEL30_SNIFF_SR_0p4Hz 
ACCEL30_SNIFF_SR_0p8Hz 
ACCEL30_SNIFF_SR_2Hz 
ACCEL30_SNIFF_SR_6Hz 
ACCEL30_SNIFF_SR_13Hz 
ACCEL30_SNIFF_SR_25Hz 
ACCEL30_SNIFF_SR_50Hz 
ACCEL30_SNIFF_SR_100Hz 
ACCEL30_SNIFF_SR_200Hz 
ACCEL30_SNIFF_SR_400Hz 
ACCEL30_SNIFF_SR_END