ChibiOS 21.11.4

Detailed Description

Collaboration diagram for ADXL317:

ADXL317 data structures and types

enum  adxl317_sad_t { ADXL317_SAD_GND = 0x53 , ADXL317_SAD_VCC = 0x1D }
 ADXL317 Slave Address. More...
enum  adxl317_state_t { ADXL317_UNINIT = 0 , ADXL317_STOP = 1 , ADXL317_READY = 2 }
 Driver state machine possible states. More...
enum  adxl317_acc_x_lp_t {
  ADXL317_ACC_X_LP_DISABLED = 0x00 , ADXL317_ACC_X_LP_500 = 0x4F , ADXL317_ACC_X_LP_1000 = 0x4A , ADXL317_ACC_X_LP_2000 = 0x45 ,
  ADXL317_ACC_X_LP_4000 = 0x40
}
 ADXL317 X LP filter. More...
enum  adxl317_acc_y_lp_t {
  ADXL317_ACC_Y_LP_DISABLED = 0x00 , ADXL317_ACC_Y_LP_500 = 0x4F , ADXL317_ACC_Y_LP_1000 = 0x4A , ADXL317_ACC_Y_LP_2000 = 0x45 ,
  ADXL317_ACC_Y_LP_4000 = 0x40
}
 ADXL317 Y LP filter. More...
enum  adxl317_acc_z_lp_t {
  ADXL317_ACC_Z_LP_DISABLED = 0x00 , ADXL317_ACC_Z_LP_500 = 0x4F , ADXL317_ACC_Z_LP_1000 = 0x4A , ADXL317_ACC_Z_LP_2000 = 0x45 ,
  ADXL317_ACC_Z_LP_4000 = 0x40
}
 ADXL317 Z LP filter. More...
enum  adxl317_acc_x_hp_t {
  ADXL317_ACC_X_HP_DISABLED = 0x00 , ADXL317_ACC_X_HP_29 = 0x80 , ADXL317_ACC_X_HP_7 = 0x90 , ADXL317_ACC_X_HP_1 = 0xA0 ,
  ADXL317_ACC_X_HP_0_5 = 0xB0
}
 ADXL317 X HP filter. More...
enum  adxl317_acc_y_hp_t {
  ADXL317_ACC_Y_HP_DISABLED = 0x00 , ADXL317_ACC_Y_HP_29 = 0x80 , ADXL317_ACC_Y_HP_7 = 0x90 , ADXL317_ACC_Y_HP_1 = 0xA0 ,
  ADXL317_ACC_Y_HP_0_5 = 0xB0
}
 ADXL317 Y HP filter. More...
enum  adxl317_acc_z_hp_t {
  ADXL317_ACC_Z_HP_DISABLED = 0x00 , ADXL317_ACC_Z_HP_29 = 0x80 , ADXL317_ACC_Z_HP_7 = 0x90 , ADXL317_ACC_Z_HP_1 = 0xA0 ,
  ADXL317_ACC_Z_HP_0_5 = 0xB0
}
 ADXL317 Z HP filter. More...
typedef struct ADXL317Driver ADXL317Driver
 Structure representing a ADXL317 driver.
#define _adxl317_methods_alone
 ADXL317 specific methods.
#define _adxl317_methods
 ADXL317 specific methods with inherited ones.
#define _adxl317_data
 ADXL317Driver specific data.

Version identification

#define EX_ADXL317_VERSION   "1.0.0"
 ADXL317 driver version string.
#define EX_ADXL317_MAJOR   1
 ADXL317 driver version major number.
#define EX_ADXL317_MINOR   0
 ADXL317 driver version minor number.
#define EX_ADXL317_PATCH   0
 ADXL317 driver version patch number.
#define ADXL317_ACC_NUMBER_OF_AXES   3U
 ADXL317 accelerometer subsystem characteristics.
#define ADXL317_ACC_SENS   2.0f
#define ADXL317_ACC_BIAS   0.0f

ADXL317 register addresses

#define ADXL317_AD_DEVID_0   0x00
#define ADXL317_AD_DEVID_1   0x01
#define ADXL317_AD_USER_REG_KEY   0x80
#define ADXL317_AD_I2C_CFGO   0x81
#define ADXL317_AD_I2C_CFG1   0x82
#define ADXL317_AD_CLK_RATE   0x83
#define ADXL317_AD_X_ST   0x84
#define ADXL317_AD_X_FILT   0x85
#define ADXL317_AD_Y_ST   0x86
#define ADXL317_AD_Y_FILT   0x87
#define ADXL317_AD_Z_ST   0x88
#define ADXL317_AD_Z_FILT   0x89
#define ADXL317_AD_X_DATA_LO   0x8A
#define ADXL317_AD_X_DATA_HI   0x8B
#define ADXL317_AD_Y_DATA_LO   0x8C
#define ADXL317_AD_Y_DATA_HI   0x8D
#define ADXL317_AD_Z_DATA_LO   0x8E
#define ADXL317_AD_Z_DATA_HI   0x8F

ADXL317 Device Identifier

#define ADXL317_DEVID_0   0x22

ADXL317 Device User Reg Key for Register Write Enable

#define ADXL317_USER_REG_KEY_0   0xBC
#define ADXL317_USER_REG_KEY_1   0x43

ADXL317 Default filter

LP (CIC and IIR cascade) with cut off at 4kHz HP disabled

#define ADXL317_DEFAULT_FILTER   0x40

ADXL317_I2S_CFG0 register bits definitions

#define ADXL317_I2S_CFG0_MASK   0xF3
#define ADXL317_I2S_CFG0_TDMMODE_0   (1 << 0)
#define ADXL317_I2S_CFG0_TDMMODE_1   (1 << 1)
#define ADXL317_I2S_CFG0_TDMSS   (1 << 4)
#define ADXL317_I2S_CFG0_ALT   (1 << 5)
#define ADXL317_I2S_CFG0_EARLY   (1 << 6)
#define ADXL317_I2S_CFG0_INV   (1 << 7)

ADXL317_I2S_CFG1 register bits definitions

#define ADXL317_I2S_CFG1_MASK   0x07
#define ADXL317_I2S_CFG1_TX0EN   (1 << 0)
#define ADXL317_I2S_CFG1_TX1EN   (1 << 1)
#define ADXL317_I2S_CFG1_TXBCLKINV   (1 << 3)

ADXL317_CLOCK_RATE register bits definitions

#define ADXL317_CLOCK_RATE_MASK   0x07
#define ADXL317_CLOCK_RATE_A2B_CLK_RATE_0   (1 << 0)
#define ADXL317_CLOCK_RATE_A2B_CLK_RATE_1   (1 << 1)
#define ADXL317_CLOCK_RATE_A2B_CLK_RATE_2   (1 << 3)

Configuration options

#define ADXL317_USE_I2C   TRUE
 ADXL317 I2C interface switch.
#define ADXL317_SHARED_I2C   FALSE
 ADXL317 shared I2C switch.
#define ADXL317_USE_ADVANCED   FALSE
 ADXL317 advanced configurations switch.
#define ADXL317_MAX_BUFF_SIZE   6
 ADXL317 internal maximum communication buffer sizes.

Data Structures

struct  adxl317_acc_lp_t
 ADXL317 LP filter configuration. More...
struct  adxl317_acc_hp_t
 ADXL317 HP filter configuration. More...
struct  ADXL317Config
 ADXL317 configuration structure. More...
struct  ADXL317VMT
 ADXL317 virtual methods table. More...
struct  ADXL317Driver
 ADXL317 3-axis accelerometer class. More...

Macros

#define adxl317AccelerometerGetAxesNumber(devp)
 Return the number of axes of the BaseAccelerometer.
#define adxl317AccelerometerReadRaw(devp, axes)
 Retrieves raw data from the BaseAccelerometer.
#define adxl317AccelerometerReadCooked(devp, axes)
 Retrieves cooked data from the BaseAccelerometer.

Functions

static msg_t adxl317I2CReadRegister (ADXL317Driver *devp, uint8_t reg, uint8_t *b, size_t n)
 Reads a generic register value using I2C.
static msg_t adxl317I2CWriteRegister (ADXL317Driver *devp, uint8_t reg, uint8_t *b, size_t n)
 Writes a value into a generic register using I2C.
static size_t acc_get_axes_number (void *ip)
 Return the number of axes of the BaseAccelerometer.
static msg_t acc_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseAccelerometer.
static msg_t acc_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseAccelerometer.
static msg_t acc_set_bias (void *ip, float *bp)
 Set bias values for the BaseAccelerometer.
static msg_t acc_reset_bias (void *ip)
 Reset bias values for the BaseAccelerometer.
static msg_t acc_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseAccelerometer.
static msg_t acc_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseAccelerometer.
void adxl317ObjectInit (ADXL317Driver *devp, uint8_t *txbp, uint8_t *rxbp)
 Initializes an instance.
msg_t adxl317Start (ADXL317Driver *devp, const ADXL317Config *config)
 Configures and activates ADXL317 Complex Driver peripheral.
void adxl317Stop (ADXL317Driver *devp)
 Deactivates the ADXL317 Complex Driver peripheral.

Variables

static const struct ADXL317VMT vmt_device
static const struct BaseAccelerometerVMT vmt_accelerometer

Macro Definition Documentation

◆ EX_ADXL317_VERSION

#define EX_ADXL317_VERSION   "1.0.0"

ADXL317 driver version string.

Definition at line 46 of file adxl317.h.

◆ EX_ADXL317_MAJOR

#define EX_ADXL317_MAJOR   1

ADXL317 driver version major number.

Definition at line 51 of file adxl317.h.

◆ EX_ADXL317_MINOR

#define EX_ADXL317_MINOR   0

ADXL317 driver version minor number.

Definition at line 56 of file adxl317.h.

◆ EX_ADXL317_PATCH

#define EX_ADXL317_PATCH   0

ADXL317 driver version patch number.

Definition at line 61 of file adxl317.h.

◆ ADXL317_ACC_NUMBER_OF_AXES

#define ADXL317_ACC_NUMBER_OF_AXES   3U

ADXL317 accelerometer subsystem characteristics.

Note
Sensitivity is expressed as milli-G/LSB whereas 1 milli-G = 0.00980665 m/s^2.
Bias is expressed as milli-G.

Definition at line 72 of file adxl317.h.

Referenced by acc_get_axes_number(), acc_read_cooked(), acc_read_raw(), acc_reset_bias(), acc_reset_sensivity(), acc_set_bias(), acc_set_sensivity(), adxl317ObjectInit(), and adxl317Start().

◆ ADXL317_ACC_SENS

#define ADXL317_ACC_SENS   2.0f

Definition at line 75 of file adxl317.h.

Referenced by acc_reset_sensivity(), and adxl317Start().

◆ ADXL317_ACC_BIAS

#define ADXL317_ACC_BIAS   0.0f

Definition at line 76 of file adxl317.h.

Referenced by acc_reset_bias(), and adxl317Start().

◆ ADXL317_AD_DEVID_0

#define ADXL317_AD_DEVID_0   0x00

Definition at line 84 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_AD_DEVID_1

#define ADXL317_AD_DEVID_1   0x01

Definition at line 85 of file adxl317.h.

◆ ADXL317_AD_USER_REG_KEY

#define ADXL317_AD_USER_REG_KEY   0x80

Definition at line 86 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_AD_I2C_CFGO

#define ADXL317_AD_I2C_CFGO   0x81

Definition at line 87 of file adxl317.h.

◆ ADXL317_AD_I2C_CFG1

#define ADXL317_AD_I2C_CFG1   0x82

Definition at line 88 of file adxl317.h.

◆ ADXL317_AD_CLK_RATE

#define ADXL317_AD_CLK_RATE   0x83

Definition at line 89 of file adxl317.h.

◆ ADXL317_AD_X_ST

#define ADXL317_AD_X_ST   0x84

Definition at line 90 of file adxl317.h.

◆ ADXL317_AD_X_FILT

#define ADXL317_AD_X_FILT   0x85

Definition at line 91 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_AD_Y_ST

#define ADXL317_AD_Y_ST   0x86

Definition at line 92 of file adxl317.h.

◆ ADXL317_AD_Y_FILT

#define ADXL317_AD_Y_FILT   0x87

Definition at line 93 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_AD_Z_ST

#define ADXL317_AD_Z_ST   0x88

Definition at line 94 of file adxl317.h.

◆ ADXL317_AD_Z_FILT

#define ADXL317_AD_Z_FILT   0x89

Definition at line 95 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_AD_X_DATA_LO

#define ADXL317_AD_X_DATA_LO   0x8A

Definition at line 96 of file adxl317.h.

Referenced by acc_read_raw().

◆ ADXL317_AD_X_DATA_HI

#define ADXL317_AD_X_DATA_HI   0x8B

Definition at line 97 of file adxl317.h.

◆ ADXL317_AD_Y_DATA_LO

#define ADXL317_AD_Y_DATA_LO   0x8C

Definition at line 98 of file adxl317.h.

◆ ADXL317_AD_Y_DATA_HI

#define ADXL317_AD_Y_DATA_HI   0x8D

Definition at line 99 of file adxl317.h.

◆ ADXL317_AD_Z_DATA_LO

#define ADXL317_AD_Z_DATA_LO   0x8E

Definition at line 100 of file adxl317.h.

◆ ADXL317_AD_Z_DATA_HI

#define ADXL317_AD_Z_DATA_HI   0x8F

Definition at line 101 of file adxl317.h.

◆ ADXL317_DEVID_0

#define ADXL317_DEVID_0   0x22

Definition at line 108 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_USER_REG_KEY_0

#define ADXL317_USER_REG_KEY_0   0xBC

Definition at line 115 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_USER_REG_KEY_1

#define ADXL317_USER_REG_KEY_1   0x43

Definition at line 116 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_DEFAULT_FILTER

#define ADXL317_DEFAULT_FILTER   0x40

Definition at line 125 of file adxl317.h.

Referenced by adxl317Start().

◆ ADXL317_I2S_CFG0_MASK

#define ADXL317_I2S_CFG0_MASK   0xF3

Definition at line 132 of file adxl317.h.

◆ ADXL317_I2S_CFG0_TDMMODE_0

#define ADXL317_I2S_CFG0_TDMMODE_0   (1 << 0)

Definition at line 133 of file adxl317.h.

◆ ADXL317_I2S_CFG0_TDMMODE_1

#define ADXL317_I2S_CFG0_TDMMODE_1   (1 << 1)

Definition at line 134 of file adxl317.h.

◆ ADXL317_I2S_CFG0_TDMSS

#define ADXL317_I2S_CFG0_TDMSS   (1 << 4)

Definition at line 135 of file adxl317.h.

◆ ADXL317_I2S_CFG0_ALT

#define ADXL317_I2S_CFG0_ALT   (1 << 5)

Definition at line 136 of file adxl317.h.

◆ ADXL317_I2S_CFG0_EARLY

#define ADXL317_I2S_CFG0_EARLY   (1 << 6)

Definition at line 137 of file adxl317.h.

◆ ADXL317_I2S_CFG0_INV

#define ADXL317_I2S_CFG0_INV   (1 << 7)

Definition at line 138 of file adxl317.h.

◆ ADXL317_I2S_CFG1_MASK

#define ADXL317_I2S_CFG1_MASK   0x07

Definition at line 145 of file adxl317.h.

◆ ADXL317_I2S_CFG1_TX0EN

#define ADXL317_I2S_CFG1_TX0EN   (1 << 0)

Definition at line 146 of file adxl317.h.

◆ ADXL317_I2S_CFG1_TX1EN

#define ADXL317_I2S_CFG1_TX1EN   (1 << 1)

Definition at line 147 of file adxl317.h.

◆ ADXL317_I2S_CFG1_TXBCLKINV

#define ADXL317_I2S_CFG1_TXBCLKINV   (1 << 3)

Definition at line 148 of file adxl317.h.

◆ ADXL317_CLOCK_RATE_MASK

#define ADXL317_CLOCK_RATE_MASK   0x07

Definition at line 155 of file adxl317.h.

◆ ADXL317_CLOCK_RATE_A2B_CLK_RATE_0

#define ADXL317_CLOCK_RATE_A2B_CLK_RATE_0   (1 << 0)

Definition at line 156 of file adxl317.h.

◆ ADXL317_CLOCK_RATE_A2B_CLK_RATE_1

#define ADXL317_CLOCK_RATE_A2B_CLK_RATE_1   (1 << 1)

Definition at line 157 of file adxl317.h.

◆ ADXL317_CLOCK_RATE_A2B_CLK_RATE_2

#define ADXL317_CLOCK_RATE_A2B_CLK_RATE_2   (1 << 3)

Definition at line 158 of file adxl317.h.

◆ ADXL317_USE_I2C

#define ADXL317_USE_I2C   TRUE

ADXL317 I2C interface switch.

If set to TRUE the support for I2C is included.

Note
The default is FALSE.

Definition at line 175 of file adxl317.h.

◆ ADXL317_SHARED_I2C

#define ADXL317_SHARED_I2C   FALSE

ADXL317 shared I2C switch.

If set to TRUE the device acquires I2C bus ownership on each transaction.

Note
The default is FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.

Definition at line 185 of file adxl317.h.

◆ ADXL317_USE_ADVANCED

#define ADXL317_USE_ADVANCED   FALSE

ADXL317 advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 194 of file adxl317.h.

◆ ADXL317_MAX_BUFF_SIZE

#define ADXL317_MAX_BUFF_SIZE   6

ADXL317 internal maximum communication buffer sizes.

Definition at line 201 of file adxl317.h.

Referenced by adxl317I2CWriteRegister().

◆ _adxl317_methods_alone

#define _adxl317_methods_alone

ADXL317 specific methods.

Definition at line 378 of file adxl317.h.

◆ _adxl317_methods

#define _adxl317_methods
Value:
_base_object_methods \
_adxl317_methods_alone

ADXL317 specific methods with inherited ones.

Definition at line 384 of file adxl317.h.

◆ _adxl317_data

#define _adxl317_data
Value:
/* Driver state.*/ \
adxl317_state_t state; \
/* Current configuration data.*/ \
const ADXL317Config *config; \
/* Accelerometer subsystem axes number.*/ \
size_t accaxes; \
/* Accelerometer subsystem current sensitivity.*/ \
float accsensitivity[ADXL317_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current bias .*/ \
float accbias[ADXL317_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current full scale value.*/ \
float accfullscale; \
/* Accelerometer communication tx buffer pointer.*/ \
uint8_t* commtxp; \
/* Accelerometer communication rx buffer pointer.*/ \
uint8_t* commrxp;
adxl317_state_t
Driver state machine possible states.
Definition adxl317.h:241
#define ADXL317_ACC_NUMBER_OF_AXES
ADXL317 accelerometer subsystem characteristics.
Definition adxl317.h:72
#define _base_sensor_data
BaseSensor specific data.
Definition ex_sensors.h:74
ADXL317 configuration structure.
Definition adxl317.h:343

ADXL317Driver specific data.

Definition at line 400 of file adxl317.h.

◆ adxl317AccelerometerGetAxesNumber

#define adxl317AccelerometerGetAxesNumber ( devp)
Value:
accelerometerGetAxesNumber(&((devp)->acc_if))
#define accelerometerGetAxesNumber(ip)
Accelerometer get axes number.

Return the number of axes of the BaseAccelerometer.

Parameters
[in]devppointer to ADXL317Driver.
Returns
the number of axes.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 444 of file adxl317.h.

◆ adxl317AccelerometerReadRaw

#define adxl317AccelerometerReadRaw ( devp,
axes )
Value:
accelerometerReadRaw(&((devp)->acc_if), axes)
#define accelerometerReadRaw(ip, dp)
Accelerometer read raw data.

Retrieves raw data from the BaseAccelerometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to ADXL317Driver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 465 of file adxl317.h.

◆ adxl317AccelerometerReadCooked

#define adxl317AccelerometerReadCooked ( devp,
axes )
Value:
accelerometerReadCooked(&((devp)->acc_if), axes)
#define accelerometerReadCooked(ip, dp)
Accelerometer read cooked data.

Retrieves cooked data from the BaseAccelerometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as milli-G.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to ADXL317Driver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 487 of file adxl317.h.

Typedef Documentation

◆ ADXL317Driver

typedef struct ADXL317Driver ADXL317Driver

Structure representing a ADXL317 driver.

Definition at line 228 of file adxl317.h.

Enumeration Type Documentation

◆ adxl317_sad_t

ADXL317 Slave Address.

Enumerator
ADXL317_SAD_GND 

SAD pin connected to GND.

ADXL317_SAD_VCC 

SAD pin connected to VCC.

Definition at line 233 of file adxl317.h.

◆ adxl317_state_t

Driver state machine possible states.

Enumerator
ADXL317_UNINIT 

Not initialized.

ADXL317_STOP 

Stopped.

ADXL317_READY 

Ready.

Definition at line 241 of file adxl317.h.

◆ adxl317_acc_x_lp_t

ADXL317 X LP filter.

The X LP filter is a cascade of the 2 LP filters: CIC, always enabled, and IIR, that can be disabled.

Enumerator
ADXL317_ACC_X_LP_DISABLED 

LP disabled.

ADXL317_ACC_X_LP_500 

LP cut-off 506 Hz.

ADXL317_ACC_X_LP_1000 

LP cut-off 1012 Hz.

ADXL317_ACC_X_LP_2000 

LP cut-off 2025 Hz.

ADXL317_ACC_X_LP_4000 

LP cut-off 4051 Hz.

Definition at line 252 of file adxl317.h.

◆ adxl317_acc_y_lp_t

ADXL317 Y LP filter.

The Y LP filter is a cascade of the 2 LP filters: CIC, always enabled, and IIR, that can be disabled.

Enumerator
ADXL317_ACC_Y_LP_DISABLED 

LP disabled.

ADXL317_ACC_Y_LP_500 

LP cut-off 506 Hz.

ADXL317_ACC_Y_LP_1000 

LP cut-off 1012 Hz.

ADXL317_ACC_Y_LP_2000 

LP cut-off 2025 Hz.

ADXL317_ACC_Y_LP_4000 

LP cut-off 4051 Hz.

Definition at line 265 of file adxl317.h.

◆ adxl317_acc_z_lp_t

ADXL317 Z LP filter.

The Z LP filter is a cascade of the 2 LP filters: CIC, always enabled, and IIR, that can be disabled.

Enumerator
ADXL317_ACC_Z_LP_DISABLED 

LP disabled.

ADXL317_ACC_Z_LP_500 

LP cut-off 506 Hz.

ADXL317_ACC_Z_LP_1000 

LP cut-off 1012 Hz.

ADXL317_ACC_Z_LP_2000 

LP cut-off 2025 Hz.

ADXL317_ACC_Z_LP_4000 

LP cut-off 4051 Hz.

Definition at line 278 of file adxl317.h.

◆ adxl317_acc_x_hp_t

ADXL317 X HP filter.

The X HP filter is HPF filter.

Enumerator
ADXL317_ACC_X_HP_DISABLED 

HP disabled.

ADXL317_ACC_X_HP_29 

HP enabled with cut-off 29.8 Hz.

ADXL317_ACC_X_HP_7 

HP enabled with cut-off 7.46 Hz.

ADXL317_ACC_X_HP_1 

HP enabled with cut-off 1.85 Hz.

ADXL317_ACC_X_HP_0_5 

HP enabled with cut-off 0.46 Hz.

Definition at line 299 of file adxl317.h.

◆ adxl317_acc_y_hp_t

ADXL317 Y HP filter.

The Y HP filter is HPF filter.

Enumerator
ADXL317_ACC_Y_HP_DISABLED 

HP disabled.

ADXL317_ACC_Y_HP_29 

HP enabled with cut-off 29.8 Hz.

ADXL317_ACC_Y_HP_7 

HP enabled with cut-off 7.46 Hz.

ADXL317_ACC_Y_HP_1 

HP enabled with cut-off 1.85 Hz.

ADXL317_ACC_Y_HP_0_5 

HP enabled with cut-off 0.46 Hz.

Definition at line 311 of file adxl317.h.

◆ adxl317_acc_z_hp_t

ADXL317 Z HP filter.

The Z HP filter is HPF filter.

Enumerator
ADXL317_ACC_Z_HP_DISABLED 

HP disabled.

ADXL317_ACC_Z_HP_29 

HP enabled with cut-off 29.8 Hz.

ADXL317_ACC_Z_HP_7 

HP enabled with cut-off 7.46 Hz.

ADXL317_ACC_Z_HP_1 

HP enabled with cut-off 1.85 Hz.

ADXL317_ACC_Z_HP_0_5 

HP enabled with cut-off 0.46 Hz.

Definition at line 323 of file adxl317.h.

Function Documentation

◆ adxl317I2CReadRegister()

msg_t adxl317I2CReadRegister ( ADXL317Driver * devp,
uint8_t reg,
uint8_t * b,
size_t n )
static

Reads a generic register value using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]devppointer to ADXL317Driver interface.
[in]regstarting register address
[in]bpointer to an output buffer
[in]nnumber of consecutive registers to read.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more errors occurred.
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 64 of file adxl317.c.

References ADXL317_SAD_GND, i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by acc_read_raw(), and adxl317Start().

Here is the call graph for this function:

◆ adxl317I2CWriteRegister()

msg_t adxl317I2CWriteRegister ( ADXL317Driver * devp,
uint8_t reg,
uint8_t * b,
size_t n )
static

Writes a value into a generic register using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]devppointer to ADXL317Driver interface.
[in]regstarting register address
[in]bpointer to a buffer of values
[in]nnumber of adjacent registers to write.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more errors occurred.
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 86 of file adxl317.c.

References ADXL317_MAX_BUFF_SIZE, ADXL317_SAD_GND, i2cMasterTransmitTimeout(), MSG_OK, and TIME_INFINITE.

Referenced by adxl317Start().

Here is the call graph for this function:

◆ acc_get_axes_number()

size_t acc_get_axes_number ( void * ip)
static

Return the number of axes of the BaseAccelerometer.

Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
the number of axes.

Definition at line 115 of file adxl317.c.

References ADXL317_ACC_NUMBER_OF_AXES.

◆ acc_read_raw()

msg_t acc_read_raw ( void * ip,
int32_t axes[] )
static

Retrieves raw data from the BaseAccelerometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 137 of file adxl317.c.

References ADXL317_ACC_NUMBER_OF_AXES, ADXL317_AD_X_DATA_LO, ADXL317_READY, adxl317I2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by acc_read_cooked().

Here is the call graph for this function:

◆ acc_read_cooked()

msg_t acc_read_cooked ( void * ip,
float axes[] )
static

Retrieves cooked data from the BaseAccelerometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as milli-G.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 185 of file adxl317.c.

References acc_read_raw(), ADXL317_ACC_NUMBER_OF_AXES, ADXL317_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

◆ acc_set_bias()

msg_t acc_set_bias ( void * ip,
float * bp )
static

Set bias values for the BaseAccelerometer.

Note
Bias must be expressed as milli-G.
The bias buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 222 of file adxl317.c.

References ADXL317_ACC_NUMBER_OF_AXES, ADXL317_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

◆ acc_reset_bias()

msg_t acc_reset_bias ( void * ip)
static

Reset bias values for the BaseAccelerometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 251 of file adxl317.c.

References ADXL317_ACC_BIAS, ADXL317_ACC_NUMBER_OF_AXES, ADXL317_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

◆ acc_set_sensivity()

msg_t acc_set_sensivity ( void * ip,
float * sp )
static

Set sensitivity values for the BaseAccelerometer.

Note
Sensitivity must be expressed as milli-G/LSB.
The sensitivity buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 281 of file adxl317.c.

References ADXL317_ACC_NUMBER_OF_AXES, ADXL317_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

◆ acc_reset_sensivity()

msg_t acc_reset_sensivity ( void * ip)
static

Reset sensitivity values for the BaseAccelerometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 310 of file adxl317.c.

References ADXL317_ACC_NUMBER_OF_AXES, ADXL317_ACC_SENS, ADXL317_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

◆ adxl317ObjectInit()

void adxl317ObjectInit ( ADXL317Driver * devp,
uint8_t * txbp,
uint8_t * rxbp )

Initializes an instance.

The buffer should be at least large ADXL317_COMM_BUFF_SIZE.

Note
The communication buffer could be used by DMAs.
Parameters
[out]devppointer to the ADXL317Driver object
[in]txbppointer to a buffer used as communication tx buffer
[in]rxbppointer to a buffer used as communication rx buffer
Function Class:
Object or module nitializer function.

Definition at line 353 of file adxl317.c.

References ADXL317Driver::acc_if, ADXL317_ACC_NUMBER_OF_AXES, ADXL317_STOP, ADXL317Driver::vmt, BaseAccelerometer::vmt, vmt_accelerometer, and vmt_device.

◆ adxl317Start()

msg_t adxl317Start ( ADXL317Driver * devp,
const ADXL317Config * config )

Configures and activates ADXL317 Complex Driver peripheral.

Parameters
[in]devppointer to the ADXL317Driver object
[in]configpointer to the ADXL317Config object
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 374 of file adxl317.c.

References ADXL317_ACC_BIAS, ADXL317_ACC_NUMBER_OF_AXES, ADXL317_ACC_SENS, ADXL317_AD_DEVID_0, ADXL317_AD_USER_REG_KEY, ADXL317_AD_X_FILT, ADXL317_AD_Y_FILT, ADXL317_AD_Z_FILT, ADXL317_DEFAULT_FILTER, ADXL317_DEVID_0, ADXL317_READY, ADXL317_STOP, ADXL317_USER_REG_KEY_0, ADXL317_USER_REG_KEY_1, adxl317I2CReadRegister(), adxl317I2CWriteRegister(), i2cStart(), MSG_OK, osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

Here is the call graph for this function:

◆ adxl317Stop()

void adxl317Stop ( ADXL317Driver * devp)

Deactivates the ADXL317 Complex Driver peripheral.

Parameters
[in]devppointer to the ADXL317Driver object
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 474 of file adxl317.c.

References ADXL317_READY, ADXL317_STOP, i2cStop(), osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

Variable Documentation

◆ vmt_device

◆ vmt_accelerometer

const struct BaseAccelerometerVMT vmt_accelerometer
static
Initial value:
= {
sizeof(struct ADXL317VMT*),
}
static size_t acc_get_axes_number(void *ip)
Return the number of axes of the BaseAccelerometer.
Definition adxl317.c:115
static msg_t acc_reset_sensivity(void *ip)
Reset sensitivity values for the BaseAccelerometer.
Definition adxl317.c:310
static msg_t acc_set_bias(void *ip, float *bp)
Set bias values for the BaseAccelerometer.
Definition adxl317.c:222
static msg_t acc_reset_bias(void *ip)
Reset bias values for the BaseAccelerometer.
Definition adxl317.c:251
static msg_t acc_set_sensivity(void *ip, float *sp)
Set sensitivity values for the BaseAccelerometer.
Definition adxl317.c:281
static msg_t acc_read_cooked(void *ip, float axes[])
Retrieves cooked data from the BaseAccelerometer.
Definition adxl317.c:185
static msg_t acc_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseAccelerometer.
Definition adxl317.c:137
ADXL317 virtual methods table.
Definition adxl317.h:393

Definition at line 332 of file adxl317.c.

Referenced by adxl317ObjectInit(), adxl355ObjectInit(), lis302dlObjectInit(), lis3dshObjectInit(), lsm303agrObjectInit(), lsm303dlhcObjectInit(), lsm6ds0ObjectInit(), and lsm6dslObjectInit().