no-OS
Classes | Macros | Enumerations | Functions
adxl38x.h File Reference

Header file of ADXL38X Driver. More...

#include <stdint.h>
#include <stdbool.h>
#include "no_os_i2c.h"
#include "no_os_spi.h"
Include dependency graph for adxl38x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adxl38x_fractional_val
 Data format in which the values are converted. More...
 
union  adxl38x_comm_desc
 
union  adxl38x_comm_init_param
 
struct  adxl38x_dev
 ADXL38X Device structure. More...
 
struct  adxl38x_init_param
 Structure holding the parameters for ADXL38X device initialization. More...
 
struct  _adxl38x_sts_reg_flags
 
union  adxl38x_sts_reg_flags
 

Macros

#define ADXL38X_SPI_READ   0x01
 
#define ADXL38X_SPI_WRITE   0x00
 
#define ADXL38X_DEVID_AD   0x00
 
#define ADXL38X_DEVID_MST   0x01
 
#define ADXL38X_PART_ID   0x02
 
#define ADXL38X_PART_ID_REV_ID   0x03
 
#define ADXL38X_SERIAL_NUMBER_0   0x04
 
#define ADXL38X_SERIAL_NUMBER_1   0x05
 
#define ADXL38X_SERIAL_NUMBER_2   0x06
 
#define ADXL38X_SERIAL_NUMBER_3   0x07
 
#define ADXL38X_SERIAL_NUMBER_4   0x08
 
#define ADXL38X_SERIAL_NUMBER_5   0x09
 
#define ADXL38X_SERIAL_NUMBER_6   0x0A
 
#define ADXL38X_DEV_DELTA_Q_X   0x0B
 
#define ADXL38X_DEV_DELTA_Q_Y   0x0C
 
#define ADXL38X_DEV_DELTA_Q_Z   0x0D
 
#define ADXL38X_DEV_DELTA_F0_X   0x0E
 
#define ADXL38X_DEV_DELTA_F0_Y   0x0F
 
#define ADXL38X_DEV_DELTA_F0_Z   0x10
 
#define ADXL38X_STATUS0   0x11
 
#define ADXL38X_STATUS1   0x12
 
#define ADXL38X_STATUS2   0x13
 
#define ADXL38X_STATUS3   0x14
 
#define ADXL38X_XDATA_H   0x15
 
#define ADXL38X_XDATA_L   0x16
 
#define ADXL38X_YDATA_H   0x17
 
#define ADXL38X_YDATA_L   0x18
 
#define ADXL38X_ZDATA_H   0x19
 
#define ADXL38X_ZDATA_L   0x1A
 
#define ADXL38X_TDATA_H   0x1B
 
#define ADXL38X_TDATA_L   0x1C
 
#define ADXL38X_FIFO_DATA   0x1D
 
#define ADXL38X_FIFO_STATUS0   0x1E
 
#define ADXL38X_FIFO_STATUS1   0x1F
 
#define ADXL38X_MISC0   0x20
 
#define ADXL38X_MISC1   0x21
 
#define ADXL38X_SENS_DSM   0x24
 
#define ADXL38X_CLK_CTRL   0x25
 
#define ADXL38X_OP_MODE   0x26
 
#define ADXL38X_DIG_EN   0x27
 
#define ADXL38X_SAR_I2C   0x28
 
#define ADXL38X_NVM_CTL   0x29
 
#define ADXL38X_REG_RESET   0x2A
 
#define ADXL38X_INT0_MAP0   0x2B
 
#define ADXL38X_INT0_MAP1   0x2C
 
#define ADXL38X_INT1_MAP0   0x2D
 
#define ADXL38X_INT1_MAP1   0x2E
 
#define ADXL38X_TEST_EN   0x2F
 
#define ADXL38X_FIFO_CFG0   0x30
 
#define ADXL38X_FIFO_CFG1   0x31
 
#define ADXL38X_SPT_CFG0   0x32
 
#define ADXL38X_SPT_CFG1   0x33
 
#define ADXL38X_SPT_CFG2   0x34
 
#define ADXL38X_SYNC_CFG   0x35
 
#define ADXL38X_PDM_CFG   0x36
 
#define ADXL38X_ACT_INACT_CTL   0x37
 
#define ADXL38X_SNSR_AXIS_EN   0x38
 
#define ADXL38X_THRESH_ACT_H   0x39
 
#define ADXL38X_THRESH_ACT_L   0x3A
 
#define ADXL38X_TIME_ACT_H   0x3B
 
#define ADXL38X_TIME_ACT_M   0x3C
 
#define ADXL38X_TIME_ACT_L   0x3D
 
#define ADXL38X_THRESH_INACT_H   0x3E
 
#define ADXL38X_THRESH_INACT_L   0x3F
 
#define ADXL38X_TIME_INACT_H   0x40
 
#define ADXL38X_TIME_INACT_M   0x41
 
#define ADXL38X_TIME_INACT_L   0x42
 
#define ADXL38X_TAP_THRESH   0x43
 
#define ADXL38X_TAP_DUR   0x44
 
#define ADXL38X_TAP_LATENT   0x45
 
#define ADXL38X_TAP_WINDOW   0x46
 
#define ADXL38X_TAP_CFG   0x47
 
#define ADXL38X_OR_CFG   0x48
 
#define ADXL38X_TRIG_CFG   0x49
 
#define ADXL38X_X_SAR_OFFSET   0x4A
 
#define ADXL38X_Y_SAR_OFFSET   0x4B
 
#define ADXL38X_Z_SAR_OFFSET   0x4C
 
#define ADXL38X_X_DSM_OFFSET   0x4D
 
#define ADXL38X_Y_DSM_OFFSET   0x4E
 
#define ADXL38X_Z_DSM_OFFSET   0x4F
 
#define ADXL38X_FILTER   0x50
 
#define ADXL38X_USER_TEMP_SENS_0   0x55
 
#define ADXL38X_USER_TEMP_SENS_1   0x56
 
#define ADXL38X_MISO   0x58
 
#define ADXL38X_SOUT0   0x59
 
#define ADXL38X_MCLK   0x5A
 
#define ADXL38X_BCLK   0x5B
 
#define ADXL38X_FSYNC   0x5C
 
#define ADXL38X_INT0   0x5D
 
#define ADXL38X_INT1   0x5E
 
#define ADXL38X_RESET_ZERO   0x00
 
#define ADXL38X_RESET_DEVID_AD   0xAD
 
#define ADXL38X_RESET_DEVID_MST   0x1D
 
#define ADXL38X_RESET_PART_ID   0x17
 
#define ADXL38X_RESET_PART_ID_REV_ID   0xC1
 
#define ADXL38X_RESET_STATUS0   0x80
 
#define ADXL38X_RESET_STATUS2   0x04
 
#define ADXL38X_RESET_INT0_MAP0   0x80
 
#define ADXL38X_RESET_INT1_MAP1   0x80
 
#define ADXL38X_RESET_SPT_CFG1   0x08
 
#define ADXL38X_RESET_SPT_CFG2   0x1A
 
#define ADXL38X_MASK_RANGE   0xC0
 
#define ADXL38X_MASK_OP_MODE   0x0F
 
#define ADXL38X_MASK_CHEN_DIG_EN   0xF0
 
#define ADXL38X_NEG_ACC_MSK   NO_OS_GENMASK(31, 16)
 
#define ADXL38X_SLF_TST_CTRL_MSK   0xE0
 
#define ADXL38X_FIFOCFG_FIFOMODE_MSK   0x30
 
#define ADXL38X_RESET_CODE   0x52
 
#define ADXL38X_RESET_STATUS   0x80000400
 
#define ADXL380_ACC_SCALE_FACTOR_GEE_MUL   (int64_t) 1333
 
#define ADXL382_ACC_SCALE_FACTOR_GEE_MUL   (int64_t) 5000
 
#define ADXL38X_ACC_SCALE_FACTOR_GEE_DIV   (int32_t) 10000000
 
#define ADXL38X_TEMP_OFFSET   (int32_t) 295
 
#define ADXL38X_TEMP_SCALE_NUM   (int32_t) 102
 
#define ADXL38X_TEMP_SCALE_DEN   (int32_t) 10
 
#define ADXL380_ACC_SENSITIVITY   (int32_t) 7500
 
#define ADXL382_ACC_SENSITIVITY   (int32_t) 2000
 
#define ADXL380_XY_ST_LIMIT_MIN   29
 
#define ADXL380_Z_ST_LIMIT_MIN   27
 
#define ADXL380_XY_ST_LIMIT_MAX   50
 
#define ADXL380_Z_ST_LIMIT_MAX   32
 
#define ADXL382_XY_ST_LIMIT_MIN   31
 
#define ADXL382_Z_ST_LIMIT_MIN   26
 
#define ADXL382_XY_ST_LIMIT_MAX   42
 
#define ADXL382_Z_ST_LIMIT_MAX   34
 
#define ADXL38X_ST_LIMIT_DENOMINATOR   10
 

Enumerations

enum  adxl38x_id {
  ID_ADXL380,
  ID_ADXL382
}
 
enum  adxl38x_comm_type {
  ADXL38X_SPI_COMM,
  ADXL38X_I2C_COMM
}
 
enum  adxl38x_range {
  ADXL380_RANGE_4G = 0,
  ADXL382_RANGE_15G = 0,
  ADXL380_RANGE_8G = 1,
  ADXL382_RANGE_30G = 1,
  ADXL380_RANGE_16G = 2,
  ADXL382_RANGE_60G = 2
}
 
enum  adxl38x_op_mode {
  ADXL38X_MODE_STDBY = 0,
  ADXL38X_MODE_HRT_SND = 1,
  ADXL38X_MODE_ULP = 2,
  ADXL38X_MODE_VLP = 3,
  ADXL38X_MODE_LP = 4,
  ADXL38X_MODE_LP_SERIAL_ULP_OP = 6,
  ADXL38X_MODE_LP_SERIAL_VLP_OP = 7,
  ADXL38X_MODE_RBW = 8,
  ADXL38X_MODE_RBW_SERIAL_ULP_OP = 10,
  ADXL38X_MODE_RBW_SERIAL_VLP_OP = 11,
  ADXL38X_MODE_HP = 12,
  ADXL38X_MODE_HP_SERIAL_ULP_OP = 14,
  ADXL38X_MODE_HP_SERIAL_VLP_OP = 15
}
 
enum  adxl38x_ch_select {
  ADXL38X_CH_DSB_ALL = 0,
  ADXL38X_CH_EN_X = 1,
  ADXL38X_CH_EN_Y = 2,
  ADXL38X_CH_EN_XY = 3,
  ADXL38X_CH_EN_Z = 4,
  ADXL38X_CH_EN_YZ = 6,
  ADXL38X_CH_EN_XYZ = 7,
  ADXL38X_CH_EN_T = 8,
  ADXL38X_CH_EN_ZT = 12,
  ADXL38X_CH_EN_YZT = 14,
  ADXL38X_CH_EN_XYZT = 15
}
 
enum  adxl38x_fifo_mode {
  ADXL38X_FIFO_DISABLE = 0,
  ADXL38X_FIFO_NORMAL = 1,
  ADXL38X_FIFO_STREAM = 2,
  ADXL38X_FIFO_TRIGGER = 3
}
 

Functions

int adxl38x_read_device_data (struct adxl38x_dev *dev, uint8_t base_address, uint16_t size, uint8_t *read_data)
 Reads from the device. More...
 
int adxl38x_write_device_data (struct adxl38x_dev *dev, uint8_t base_address, uint16_t size, uint8_t *write_data)
 Writes to the device. More...
 
int adxl38x_register_update_bits (struct adxl38x_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t update_val)
 Updates register with specified bits using given mask. More...
 
int adxl38x_init (struct adxl38x_dev **device, struct adxl38x_init_param init_param)
 Initializes the device and checks for valid peripheral communication. More...
 
int adxl38x_remove (struct adxl38x_dev *dev)
 Free the resources allocated by the init function. More...
 
int adxl38x_soft_reset (struct adxl38x_dev *dev)
 Performs a soft reset of the device. More...
 
int adxl38x_get_sts_reg (struct adxl38x_dev *dev, union adxl38x_sts_reg_flags *status_flags)
 Reads the status registers. More...
 
int adxl38x_set_op_mode (struct adxl38x_dev *dev, enum adxl38x_op_mode op_mode)
 Places the device into the given operation mode. More...
 
int adxl38x_get_op_mode (struct adxl38x_dev *dev, enum adxl38x_op_mode *op_mode)
 Gets the current operation mode of the device. More...
 
int adxl38x_set_range (struct adxl38x_dev *dev, enum adxl38x_range range_val)
 Sets the measurement range register value. More...
 
int adxl38x_get_range (struct adxl38x_dev *dev, enum adxl38x_range *range_val)
 Gets the current range setting of the device. More...
 
int adxl38x_get_deviceID (struct adxl38x_dev *dev, enum adxl38x_id *devID)
 Gets the current device type. More...
 
int adxl38x_set_self_test_registers (struct adxl38x_dev *dev, bool st_mode, bool st_force, bool st_dir)
 Sets the part to execute self-test routine. More...
 
int adxl38x_get_raw_xyz (struct adxl38x_dev *dev, uint16_t *raw_x, uint16_t *raw_y, uint16_t *raw_z)
 Reads the raw output data using continuous read. More...
 
int adxl38x_get_temp (struct adxl38x_dev *dev, struct adxl38x_fractional_val *raw_temp)
 Reads the raw temperature data using burst read. More...
 
int adxl38x_get_raw_data (struct adxl38x_dev *dev, enum adxl38x_ch_select channels, uint16_t *raw_x, uint16_t *raw_y, uint16_t *raw_z, uint16_t *raw_temp)
 Reads the raw output data using burst read. More...
 
int adxl38x_get_xyz_gees (struct adxl38x_dev *dev, enum adxl38x_ch_select channels, struct adxl38x_fractional_val *x, struct adxl38x_fractional_val *y, struct adxl38x_fractional_val *z)
 Reads the raw output data of each axis and converts it to g. More...
 
int adxl38x_selftest (struct adxl38x_dev *dev, enum adxl38x_op_mode op_mode, bool *st_x, bool *st_y, bool *st_z)
 Executed Selftest on the sensing axes and returns the outcome of the test. More...
 
int adxl38x_accel_set_FIFO (struct adxl38x_dev *dev, uint16_t numSamples, bool externalTrigger, enum adxl38x_fifo_mode fifo_mode, bool chIDEnable, bool readReset)
 Function to set the paramenters for FIFO mode. More...
 
int adxl38x_data_raw_to_gees (struct adxl38x_dev *dev, uint8_t *raw_accel_data, struct adxl38x_fractional_val *data_frac)
 Function to convert accel data to gees. More...
 

Detailed Description

Header file of ADXL38X Driver.

Author
BRajendran (balar.nosp@m.upin.nosp@m.i.raj.nosp@m.endr.nosp@m.an@an.nosp@m.alog.nosp@m..com)

Copyright 2024(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ ADXL380_ACC_SCALE_FACTOR_GEE_MUL

#define ADXL380_ACC_SCALE_FACTOR_GEE_MUL   (int64_t) 1333

◆ ADXL380_ACC_SENSITIVITY

#define ADXL380_ACC_SENSITIVITY   (int32_t) 7500

◆ ADXL380_XY_ST_LIMIT_MAX

#define ADXL380_XY_ST_LIMIT_MAX   50

◆ ADXL380_XY_ST_LIMIT_MIN

#define ADXL380_XY_ST_LIMIT_MIN   29

◆ ADXL380_Z_ST_LIMIT_MAX

#define ADXL380_Z_ST_LIMIT_MAX   32

◆ ADXL380_Z_ST_LIMIT_MIN

#define ADXL380_Z_ST_LIMIT_MIN   27

◆ ADXL382_ACC_SCALE_FACTOR_GEE_MUL

#define ADXL382_ACC_SCALE_FACTOR_GEE_MUL   (int64_t) 5000

◆ ADXL382_ACC_SENSITIVITY

#define ADXL382_ACC_SENSITIVITY   (int32_t) 2000

◆ ADXL382_XY_ST_LIMIT_MAX

#define ADXL382_XY_ST_LIMIT_MAX   42

◆ ADXL382_XY_ST_LIMIT_MIN

#define ADXL382_XY_ST_LIMIT_MIN   31

◆ ADXL382_Z_ST_LIMIT_MAX

#define ADXL382_Z_ST_LIMIT_MAX   34

◆ ADXL382_Z_ST_LIMIT_MIN

#define ADXL382_Z_ST_LIMIT_MIN   26

◆ ADXL38X_ACC_SCALE_FACTOR_GEE_DIV

#define ADXL38X_ACC_SCALE_FACTOR_GEE_DIV   (int32_t) 10000000

◆ ADXL38X_ACT_INACT_CTL

#define ADXL38X_ACT_INACT_CTL   0x37

◆ ADXL38X_BCLK

#define ADXL38X_BCLK   0x5B

◆ ADXL38X_CLK_CTRL

#define ADXL38X_CLK_CTRL   0x25

◆ ADXL38X_DEV_DELTA_F0_X

#define ADXL38X_DEV_DELTA_F0_X   0x0E

◆ ADXL38X_DEV_DELTA_F0_Y

#define ADXL38X_DEV_DELTA_F0_Y   0x0F

◆ ADXL38X_DEV_DELTA_F0_Z

#define ADXL38X_DEV_DELTA_F0_Z   0x10

◆ ADXL38X_DEV_DELTA_Q_X

#define ADXL38X_DEV_DELTA_Q_X   0x0B

◆ ADXL38X_DEV_DELTA_Q_Y

#define ADXL38X_DEV_DELTA_Q_Y   0x0C

◆ ADXL38X_DEV_DELTA_Q_Z

#define ADXL38X_DEV_DELTA_Q_Z   0x0D

◆ ADXL38X_DEVID_AD

#define ADXL38X_DEVID_AD   0x00

◆ ADXL38X_DEVID_MST

#define ADXL38X_DEVID_MST   0x01

◆ ADXL38X_DIG_EN

#define ADXL38X_DIG_EN   0x27

◆ ADXL38X_FIFO_CFG0

#define ADXL38X_FIFO_CFG0   0x30

◆ ADXL38X_FIFO_CFG1

#define ADXL38X_FIFO_CFG1   0x31

◆ ADXL38X_FIFO_DATA

#define ADXL38X_FIFO_DATA   0x1D

◆ ADXL38X_FIFO_STATUS0

#define ADXL38X_FIFO_STATUS0   0x1E

◆ ADXL38X_FIFO_STATUS1

#define ADXL38X_FIFO_STATUS1   0x1F

◆ ADXL38X_FIFOCFG_FIFOMODE_MSK

#define ADXL38X_FIFOCFG_FIFOMODE_MSK   0x30

◆ ADXL38X_FILTER

#define ADXL38X_FILTER   0x50

◆ ADXL38X_FSYNC

#define ADXL38X_FSYNC   0x5C

◆ ADXL38X_INT0

#define ADXL38X_INT0   0x5D

◆ ADXL38X_INT0_MAP0

#define ADXL38X_INT0_MAP0   0x2B

◆ ADXL38X_INT0_MAP1

#define ADXL38X_INT0_MAP1   0x2C

◆ ADXL38X_INT1

#define ADXL38X_INT1   0x5E

◆ ADXL38X_INT1_MAP0

#define ADXL38X_INT1_MAP0   0x2D

◆ ADXL38X_INT1_MAP1

#define ADXL38X_INT1_MAP1   0x2E

◆ ADXL38X_MASK_CHEN_DIG_EN

#define ADXL38X_MASK_CHEN_DIG_EN   0xF0

◆ ADXL38X_MASK_OP_MODE

#define ADXL38X_MASK_OP_MODE   0x0F

◆ ADXL38X_MASK_RANGE

#define ADXL38X_MASK_RANGE   0xC0

◆ ADXL38X_MCLK

#define ADXL38X_MCLK   0x5A

◆ ADXL38X_MISC0

#define ADXL38X_MISC0   0x20

◆ ADXL38X_MISC1

#define ADXL38X_MISC1   0x21

◆ ADXL38X_MISO

#define ADXL38X_MISO   0x58

◆ ADXL38X_NEG_ACC_MSK

#define ADXL38X_NEG_ACC_MSK   NO_OS_GENMASK(31, 16)

◆ ADXL38X_NVM_CTL

#define ADXL38X_NVM_CTL   0x29

◆ ADXL38X_OP_MODE

#define ADXL38X_OP_MODE   0x26

◆ ADXL38X_OR_CFG

#define ADXL38X_OR_CFG   0x48

◆ ADXL38X_PART_ID

#define ADXL38X_PART_ID   0x02

◆ ADXL38X_PART_ID_REV_ID

#define ADXL38X_PART_ID_REV_ID   0x03

◆ ADXL38X_PDM_CFG

#define ADXL38X_PDM_CFG   0x36

◆ ADXL38X_REG_RESET

#define ADXL38X_REG_RESET   0x2A

◆ ADXL38X_RESET_CODE

#define ADXL38X_RESET_CODE   0x52

◆ ADXL38X_RESET_DEVID_AD

#define ADXL38X_RESET_DEVID_AD   0xAD

◆ ADXL38X_RESET_DEVID_MST

#define ADXL38X_RESET_DEVID_MST   0x1D

◆ ADXL38X_RESET_INT0_MAP0

#define ADXL38X_RESET_INT0_MAP0   0x80

◆ ADXL38X_RESET_INT1_MAP1

#define ADXL38X_RESET_INT1_MAP1   0x80

◆ ADXL38X_RESET_PART_ID

#define ADXL38X_RESET_PART_ID   0x17

◆ ADXL38X_RESET_PART_ID_REV_ID

#define ADXL38X_RESET_PART_ID_REV_ID   0xC1

◆ ADXL38X_RESET_SPT_CFG1

#define ADXL38X_RESET_SPT_CFG1   0x08

◆ ADXL38X_RESET_SPT_CFG2

#define ADXL38X_RESET_SPT_CFG2   0x1A

◆ ADXL38X_RESET_STATUS

#define ADXL38X_RESET_STATUS   0x80000400

◆ ADXL38X_RESET_STATUS0

#define ADXL38X_RESET_STATUS0   0x80

◆ ADXL38X_RESET_STATUS2

#define ADXL38X_RESET_STATUS2   0x04

◆ ADXL38X_RESET_ZERO

#define ADXL38X_RESET_ZERO   0x00

◆ ADXL38X_SAR_I2C

#define ADXL38X_SAR_I2C   0x28

◆ ADXL38X_SENS_DSM

#define ADXL38X_SENS_DSM   0x24

◆ ADXL38X_SERIAL_NUMBER_0

#define ADXL38X_SERIAL_NUMBER_0   0x04

◆ ADXL38X_SERIAL_NUMBER_1

#define ADXL38X_SERIAL_NUMBER_1   0x05

◆ ADXL38X_SERIAL_NUMBER_2

#define ADXL38X_SERIAL_NUMBER_2   0x06

◆ ADXL38X_SERIAL_NUMBER_3

#define ADXL38X_SERIAL_NUMBER_3   0x07

◆ ADXL38X_SERIAL_NUMBER_4

#define ADXL38X_SERIAL_NUMBER_4   0x08

◆ ADXL38X_SERIAL_NUMBER_5

#define ADXL38X_SERIAL_NUMBER_5   0x09

◆ ADXL38X_SERIAL_NUMBER_6

#define ADXL38X_SERIAL_NUMBER_6   0x0A

◆ ADXL38X_SLF_TST_CTRL_MSK

#define ADXL38X_SLF_TST_CTRL_MSK   0xE0

◆ ADXL38X_SNSR_AXIS_EN

#define ADXL38X_SNSR_AXIS_EN   0x38

◆ ADXL38X_SOUT0

#define ADXL38X_SOUT0   0x59

◆ ADXL38X_SPI_READ

#define ADXL38X_SPI_READ   0x01

◆ ADXL38X_SPI_WRITE

#define ADXL38X_SPI_WRITE   0x00

◆ ADXL38X_SPT_CFG0

#define ADXL38X_SPT_CFG0   0x32

◆ ADXL38X_SPT_CFG1

#define ADXL38X_SPT_CFG1   0x33

◆ ADXL38X_SPT_CFG2

#define ADXL38X_SPT_CFG2   0x34

◆ ADXL38X_ST_LIMIT_DENOMINATOR

#define ADXL38X_ST_LIMIT_DENOMINATOR   10

◆ ADXL38X_STATUS0

#define ADXL38X_STATUS0   0x11

◆ ADXL38X_STATUS1

#define ADXL38X_STATUS1   0x12

◆ ADXL38X_STATUS2

#define ADXL38X_STATUS2   0x13

◆ ADXL38X_STATUS3

#define ADXL38X_STATUS3   0x14

◆ ADXL38X_SYNC_CFG

#define ADXL38X_SYNC_CFG   0x35

◆ ADXL38X_TAP_CFG

#define ADXL38X_TAP_CFG   0x47

◆ ADXL38X_TAP_DUR

#define ADXL38X_TAP_DUR   0x44

◆ ADXL38X_TAP_LATENT

#define ADXL38X_TAP_LATENT   0x45

◆ ADXL38X_TAP_THRESH

#define ADXL38X_TAP_THRESH   0x43

◆ ADXL38X_TAP_WINDOW

#define ADXL38X_TAP_WINDOW   0x46

◆ ADXL38X_TDATA_H

#define ADXL38X_TDATA_H   0x1B

◆ ADXL38X_TDATA_L

#define ADXL38X_TDATA_L   0x1C

◆ ADXL38X_TEMP_OFFSET

#define ADXL38X_TEMP_OFFSET   (int32_t) 295

◆ ADXL38X_TEMP_SCALE_DEN

#define ADXL38X_TEMP_SCALE_DEN   (int32_t) 10

◆ ADXL38X_TEMP_SCALE_NUM

#define ADXL38X_TEMP_SCALE_NUM   (int32_t) 102

◆ ADXL38X_TEST_EN

#define ADXL38X_TEST_EN   0x2F

◆ ADXL38X_THRESH_ACT_H

#define ADXL38X_THRESH_ACT_H   0x39

◆ ADXL38X_THRESH_ACT_L

#define ADXL38X_THRESH_ACT_L   0x3A

◆ ADXL38X_THRESH_INACT_H

#define ADXL38X_THRESH_INACT_H   0x3E

◆ ADXL38X_THRESH_INACT_L

#define ADXL38X_THRESH_INACT_L   0x3F

◆ ADXL38X_TIME_ACT_H

#define ADXL38X_TIME_ACT_H   0x3B

◆ ADXL38X_TIME_ACT_L

#define ADXL38X_TIME_ACT_L   0x3D

◆ ADXL38X_TIME_ACT_M

#define ADXL38X_TIME_ACT_M   0x3C

◆ ADXL38X_TIME_INACT_H

#define ADXL38X_TIME_INACT_H   0x40

◆ ADXL38X_TIME_INACT_L

#define ADXL38X_TIME_INACT_L   0x42

◆ ADXL38X_TIME_INACT_M

#define ADXL38X_TIME_INACT_M   0x41

◆ ADXL38X_TRIG_CFG

#define ADXL38X_TRIG_CFG   0x49

◆ ADXL38X_USER_TEMP_SENS_0

#define ADXL38X_USER_TEMP_SENS_0   0x55

◆ ADXL38X_USER_TEMP_SENS_1

#define ADXL38X_USER_TEMP_SENS_1   0x56

◆ ADXL38X_X_DSM_OFFSET

#define ADXL38X_X_DSM_OFFSET   0x4D

◆ ADXL38X_X_SAR_OFFSET

#define ADXL38X_X_SAR_OFFSET   0x4A

◆ ADXL38X_XDATA_H

#define ADXL38X_XDATA_H   0x15

◆ ADXL38X_XDATA_L

#define ADXL38X_XDATA_L   0x16

◆ ADXL38X_Y_DSM_OFFSET

#define ADXL38X_Y_DSM_OFFSET   0x4E

◆ ADXL38X_Y_SAR_OFFSET

#define ADXL38X_Y_SAR_OFFSET   0x4B

◆ ADXL38X_YDATA_H

#define ADXL38X_YDATA_H   0x17

◆ ADXL38X_YDATA_L

#define ADXL38X_YDATA_L   0x18

◆ ADXL38X_Z_DSM_OFFSET

#define ADXL38X_Z_DSM_OFFSET   0x4F

◆ ADXL38X_Z_SAR_OFFSET

#define ADXL38X_Z_SAR_OFFSET   0x4C

◆ ADXL38X_ZDATA_H

#define ADXL38X_ZDATA_H   0x19

◆ ADXL38X_ZDATA_L

#define ADXL38X_ZDATA_L   0x1A

Enumeration Type Documentation

◆ adxl38x_ch_select

Enumerator
ADXL38X_CH_DSB_ALL 
ADXL38X_CH_EN_X 
ADXL38X_CH_EN_Y 
ADXL38X_CH_EN_XY 
ADXL38X_CH_EN_Z 
ADXL38X_CH_EN_YZ 
ADXL38X_CH_EN_XYZ 
ADXL38X_CH_EN_T 
ADXL38X_CH_EN_ZT 
ADXL38X_CH_EN_YZT 
ADXL38X_CH_EN_XYZT 

◆ adxl38x_comm_type

Enumerator
ADXL38X_SPI_COMM 
ADXL38X_I2C_COMM 

◆ adxl38x_fifo_mode

Enumerator
ADXL38X_FIFO_DISABLE 
ADXL38X_FIFO_NORMAL 
ADXL38X_FIFO_STREAM 
ADXL38X_FIFO_TRIGGER 

◆ adxl38x_id

enum adxl38x_id
Enumerator
ID_ADXL380 
ID_ADXL382 

◆ adxl38x_op_mode

Enumerator
ADXL38X_MODE_STDBY 
ADXL38X_MODE_HRT_SND 
ADXL38X_MODE_ULP 
ADXL38X_MODE_VLP 
ADXL38X_MODE_LP 
ADXL38X_MODE_LP_SERIAL_ULP_OP 
ADXL38X_MODE_LP_SERIAL_VLP_OP 
ADXL38X_MODE_RBW 
ADXL38X_MODE_RBW_SERIAL_ULP_OP 
ADXL38X_MODE_RBW_SERIAL_VLP_OP 
ADXL38X_MODE_HP 
ADXL38X_MODE_HP_SERIAL_ULP_OP 
ADXL38X_MODE_HP_SERIAL_VLP_OP 

◆ adxl38x_range

Enumerator
ADXL380_RANGE_4G 
ADXL382_RANGE_15G 
ADXL380_RANGE_8G 
ADXL382_RANGE_30G 
ADXL380_RANGE_16G 
ADXL382_RANGE_60G 

Function Documentation

◆ adxl38x_accel_set_FIFO()

int adxl38x_accel_set_FIFO ( struct adxl38x_dev dev,
uint16_t  num_samples,
bool  external_trigger,
enum adxl38x_fifo_mode  fifo_mode,
bool  ch_ID_enable,
bool  read_reset 
)

Function to set the paramenters for FIFO mode.

Parameters
dev- The device structure.
num_samples- Number of FIFO entries that FIFI_WATERMARK should set.
external_trigger- Enable/disable external trigger in FIFO stream mode.
fifo_mode- FIFO mode setting.
ch_ID_enable- Enable/disable channel ID.
read_reset- reset read/write point and read state machine.
Returns
ret - Result of the procedure.
Here is the caller graph for this function:

◆ adxl38x_data_raw_to_gees()

int adxl38x_data_raw_to_gees ( struct adxl38x_dev dev,
uint8_t *  raw_accel_data,
struct adxl38x_fractional_val data_frac 
)

Function to convert accel data to gees.

Parameters
dev- The device structure.
raw_accel_data- Raw data array of two bytes
data_frac- Fractional data in gees
Returns
ret - Result of the procedure.
Here is the caller graph for this function:

◆ adxl38x_get_deviceID()

int adxl38x_get_deviceID ( struct adxl38x_dev dev,
enum adxl38x_id devID 
)

Gets the current device type.

Parameters
dev- The device structure
devID- Read Device ID
Returns
ret - Result of the reading operation procedure.
Here is the caller graph for this function:

◆ adxl38x_get_op_mode()

int adxl38x_get_op_mode ( struct adxl38x_dev dev,
enum adxl38x_op_mode op_mode 
)

Gets the current operation mode of the device.

Parameters
dev- The device structure.
op_mode- Read operation mode.
Returns
ret - Result of the reading operation procedure.
Here is the caller graph for this function:

◆ adxl38x_get_range()

int adxl38x_get_range ( struct adxl38x_dev dev,
enum adxl38x_range range_val 
)

Gets the current range setting of the device.

Parameters
dev- The device structure.
range_val- Read range.
Returns
ret - Result of the reading operation procedure.
Here is the caller graph for this function:

◆ adxl38x_get_raw_data()

int adxl38x_get_raw_data ( struct adxl38x_dev dev,
enum adxl38x_ch_select  channels,
uint16_t *  raw_x,
uint16_t *  raw_y,
uint16_t *  raw_z,
uint16_t *  raw_temp 
)

Reads the raw output data using burst read.

Parameters
dev- The device structure.
channels- Channels to enable.
raw_x- X-axis's raw output data.
raw_y- Y-axis's raw output data.
raw_z- Z-axis's raw output data.
raw_temp- Raw temp output data.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl38x_get_raw_xyz()

int adxl38x_get_raw_xyz ( struct adxl38x_dev dev,
uint16_t *  raw_x,
uint16_t *  raw_y,
uint16_t *  raw_z 
)

Reads the raw output data using continuous read.

Parameters
dev- The device structure.
raw_x- X-axis's raw output data.
raw_y- Y-axis's raw output data.
raw_z- Z-axis's raw output data.
Returns
ret - Result of the reading procedure.

◆ adxl38x_get_sts_reg()

int adxl38x_get_sts_reg ( struct adxl38x_dev dev,
union adxl38x_sts_reg_flags status_flags 
)

Reads the status registers.

TODO: Update according to datasheet (Currently based on RevH)

Parameters
dev- The device structure.
status_flags- Combined Status value.
Returns
ret - 32-bit status value as a combination of status 0 to 3 registers.
Here is the caller graph for this function:

◆ adxl38x_get_temp()

int adxl38x_get_temp ( struct adxl38x_dev dev,
struct adxl38x_fractional_val temp_degC 
)

Reads the raw temperature data using burst read.

Parameters
dev- The device structure.
temp_degC- Temperature data in degree Celcius
Returns
ret - Result of the reading procedure.

◆ adxl38x_get_xyz_gees()

int adxl38x_get_xyz_gees ( struct adxl38x_dev dev,
enum adxl38x_ch_select  channels,
struct adxl38x_fractional_val x,
struct adxl38x_fractional_val y,
struct adxl38x_fractional_val z 
)

Reads the raw output data of each axis and converts it to g.

Parameters
dev- The device structure.
channels- Channels to enable.
x- X-axis's output data.
y- Y-axis's output data.
z- Z-axis's output data.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl38x_init()

int adxl38x_init ( struct adxl38x_dev **  device,
struct adxl38x_init_param  init_param 
)

Initializes the device and checks for valid peripheral communication.

Parameters
device- The device structure.
init_param- Structure containing initialization parameters
Returns
ret - Result of the initialization
Here is the caller graph for this function:

◆ adxl38x_read_device_data()

int adxl38x_read_device_data ( struct adxl38x_dev dev,
uint8_t  base_address,
uint16_t  size,
uint8_t *  read_data 
)

Reads from the device.

Parameters
dev- The device structure.
base_address- Address of the base register.
size- The number of bytes to be read and returned in read_data.
read_data- The read data buffer
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl38x_register_update_bits()

int adxl38x_register_update_bits ( struct adxl38x_dev dev,
uint8_t  reg_addr,
uint8_t  mask,
uint8_t  update_val 
)

Updates register with specified bits using given mask.

Parameters
dev- The device structure.
reg_addr- Address of the register to update.
mask- Mask for the update field.
update_val- Value to be updated.
Returns
ret - Result of the writing procedure.
Here is the caller graph for this function:

◆ adxl38x_remove()

int adxl38x_remove ( struct adxl38x_dev dev)

Free the resources allocated by the init function.

Parameters
dev- The device structure.
Returns
ret - Result of the remove procedure.
Here is the caller graph for this function:

◆ adxl38x_selftest()

int adxl38x_selftest ( struct adxl38x_dev dev,
enum adxl38x_op_mode  op_mode,
bool st_x,
bool st_y,
bool st_z 
)

Executed Selftest on the sensing axes and returns the outcome of the test.

Parameters
dev- The device structure.
op_mode- Operation mode in which self-test is executed
st_x- Result of X-axis self test success/failure
st_y- Result of X-axis self test success/failure
st_z- Result of X-axis self test success/failure
Returns
ret - Outcome of the selftest.
Here is the caller graph for this function:

◆ adxl38x_set_op_mode()

int adxl38x_set_op_mode ( struct adxl38x_dev dev,
enum adxl38x_op_mode  op_mode 
)

Places the device into the given operation mode.

Parameters
dev- The device structure.
op_mode- Operation mode mode.
Returns
ret - Result of the setting operation procedure.
Here is the caller graph for this function:

◆ adxl38x_set_range()

int adxl38x_set_range ( struct adxl38x_dev dev,
enum adxl38x_range  range_val 
)

Sets the measurement range register value.

Parameters
dev- The device structure.
range_val- Selected range.
Returns
ret - Result of the writing procedure.
Here is the caller graph for this function:

◆ adxl38x_set_self_test_registers()

int adxl38x_set_self_test_registers ( struct adxl38x_dev dev,
bool  st_mode,
bool  st_force,
bool  st_dir 
)

Sets the part to execute self-test routine.

NOTE: It is recommended that the ADXL380 self-test should be performed in mid and high gee ranges and in high power mode.

Parameters
dev- The device structure.
st_mode- Enable/disable bit for self test.
st_force- Enable/disable bit for forced self test.
st_dir- Direction bit for self test. 0 - Forward, 1 - Reverse.
Returns
ret - Result of the writing procedure.
Here is the caller graph for this function:

◆ adxl38x_soft_reset()

int adxl38x_soft_reset ( struct adxl38x_dev dev)

Performs a soft reset of the device.

Parameters
dev- The device structure.
Returns
ret - Result of the soft reset procedure.
Here is the caller graph for this function:

◆ adxl38x_write_device_data()

int adxl38x_write_device_data ( struct adxl38x_dev dev,
uint8_t  base_address,
uint16_t  size,
uint8_t *  write_data 
)

Writes to the device.

Parameters
dev- The device structure.
base_address- Address of the base register.
size- The number of bytes to be written. It is the size of the write_data buffer.
write_data- The data which is going to be written.
Returns
ret - Result of the writing procedure.
Here is the caller graph for this function: