43#define ADXL313_SPI_READ (0x80)
44#define ADXL313_SPI_WRITE (0x00)
45#define ADXL313_MULTIBIT NO_OS_BIT(6)
48#define ADXL313_REG_DEVID_AD 0x00
49#define ADXL313_REG_DEVID1_AD 0x01
50#define ADXL313_REG_PARTID 0x02
51#define ADXL313_REG_REVID 0x03
52#define ADXL313_REG_XID 0x04
53#define ADXL313_REG_SOFT_RESET 0x18
54#define ADXL313_REG_OFS_AXIS(index) (0x1E + (index))
55#define ADXL313_REG_THRESH_ACT 0x24
56#define ADXL313_REG_THRESH_INACT 0x25
57#define ADXL313_REG_TIME_INACT 0x26
58#define ADXL313_REG_ACT_INACT_CTL 0x27
59#define ADXL313_REG_BW_RATE 0x2C
60#define ADXL313_REG_POWER_CTL 0x2D
61#define ADXL313_REG_INT_EN 0x2E
62#define ADXL313_REG_INT_MAP 0x2F
63#define ADXL313_REG_INT_SRC 0x30
64#define ADXL313_REG_DATA_FORMAT 0x31
65#define ADXL313_REG_DATA_AXIS(index) (0x32 + ((index) * 2))
66#define ADXL313_REG_FIFO_CTL 0x38
67#define ADXL313_REG_FIFO_STATUS 0x39
70#define ADXL313_DEVID 0xAD
72#define ADXL313_DEVID1 0x1D
74#define ADXL313_PARTID 0xCB
76#define ADXL314_DEVID 0xE5
79#define ADXL313_RESET_KEY 0x52
82#define ADXL313_MAX_FIFO_SAMPLES_VAL 0x60
85#define ADXL313_RATE_MSK NO_OS_GENMASK(3, 0)
86#define ADXL313_LOW_POWER_OP NO_OS_BIT(4)
89#define ADXL313_POWER_CTL_I2C_DISABLE NO_OS_BIT(6)
90#define ADXL313_POWER_CTL_LINK NO_OS_BIT(5)
91#define ADXL313_POWER_CTL_AUTO_SLEEP NO_OS_BIT(4)
92#define ADXL313_POWER_CTL_MEASURE NO_OS_BIT(3)
93#define ADXL313_POWER_CTL_SLEEP NO_OS_BIT(2)
94#define ADXL313_POWER_CTL_WAKEUP(x) ((x) & 0x3)
97#define ADXL313_REG_INT_EN_DATA_READY NO_OS_BIT(7)
98#define ADXL313_REG_INT_EN_ACTIVITY NO_OS_BIT(4)
99#define ADXL313_REG_INT_EN_INACTIVITY NO_OS_BIT(3)
100#define ADXL313_REG_INT_EN_WATERMARK NO_OS_BIT(1)
101#define ADXL313_REG_INT_EN_OVERRUN NO_OS_BIT(0)
104#define ADXL313_REG_INT_MAP_DR_INT2 NO_OS_BIT(7)
105#define ADXL313_REG_INT_MAP_ACT_INT2 NO_OS_BIT(4)
106#define ADXL313_REG_INT_MAP_INACT_INT2 NO_OS_BIT(3)
107#define ADXL313_REG_INT_MAP_WM_INT2 NO_OS_BIT(1)
108#define ADXL313_REG_INT_MAP_OVER_INT2 NO_OS_BIT(0)
111#define ADXL313_REG_INT_SRC_DATA_READY NO_OS_BIT(7)
112#define ADXL313_REG_INT_SRC_ACTIVITY NO_OS_BIT(4)
113#define ADXL313_REG_INT_SRC_INACTIVITY NO_OS_BIT(3)
114#define ADXL313_REG_INT_SRC_WATERMARK NO_OS_BIT(1)
115#define ADXL313_REG_INT_SRC_OVERRUN NO_OS_BIT(0)
118#define ADXL313_REG_DATA_FORMAT_SELF_TEST NO_OS_BIT(7)
119#define ADXL313_REG_DATA_FORMAT_SPI_3WIRE NO_OS_BIT(6)
120#define ADXL313_REG_DATA_FORMAT_INT_INV NO_OS_BIT(5)
121#define ADXL313_REG_DATA_FORMAT_FULL_RES NO_OS_BIT(3)
122#define ADXL313_REG_DATA_FORMAT_JUSTIFY_BIT NO_OS_BIT(2)
123#define ADXL313_REG_DATA_FORMAT_RANGE NO_OS_GENMASK(1, 0)
126#define ADXL313_REG_FIFO_CTL_MODE_MSK NO_OS_GENMASK(7, 6)
127#define ADXL313_REG_FIFO_CTL_TRIGGER_BIT NO_OS_BIT(5)
128#define ADXL313_REG_FIFO_CTL_SAMPLES_MSK NO_OS_GENMASK(4, 0)
131#define ADXL313_REG_FIFO_FIFO_TRIGGER_BIT NO_OS_BIT(7)
132#define ADXL313_REG_FIFO_STS_ENTRIES_MSK NO_OS_GENMASK(5, 0)
139#define ADXL312_ACC_SCALE_FACTOR_MUL_FULL_RES ((int64_t)28439285ULL)
151#define ADXL313_ACC_SCALE_FACTOR_MUL_FULL_RES ((int64_t)957680664ULL)
154#define ADXL313_ACC_SCALE_FACTOR_MUL_DIVIDER ((int32_t)100)
161#define ADXL314_ACC_SCALE_FACTOR_MUL ((int64_t)478858719ULL)
162#define ADXL313_ACC_SCALE_FACTOR_DIV ((int32_t)1000000000)
166#define ADXL312_OFFSET_SCALE_FACTOR 11600
170#define ADXL313_OFFSET_SCALE_FACTOR 3900
174#define ADXL314_OFFSET_SCALE_FACTOR 195000
178#define ADXL312_THRESH_SCALE_FACTOR 46400
182#define ADXL313_THRESH_SCALE_FACTOR 15625
186#define ADXL314_THRESH_SCALE_FACTOR 784000
189#define ADXL313_ODR_OFFSET_VAL 6
192#define ADXL313_REGS_PER_ENTRY 6
195#define ADXL313_MAX_FIFO_ENTRIES 32
198#define ADXL313_SELF_TEST_SAMPLES 10
201#define ADXL312_SELF_TEST_MULT 2900
202#define ADXL313_SELF_TEST_MULT 976
203#define ADXL314_SELF_TEST_MULT 48830
204#define ADXL313_SELF_TEST_DIV 1000
207#define ADXL312_SELF_TEST_MIN_DEVIATION 300
209#define ADXL312_SELF_TEST_MAX_DEVIATION 3400
212#define ADXL313_SELF_TEST_MIN_DEVIATION 300
214#define ADXL313_SELF_TEST_MAX_DEVIATION 3700
217#define ADXL314_SELF_TEST_MIN_DEVIATION 100
219#define ADXL314_SELF_TEST_MAX_DEVIATION 8000
222#define ADXL313_RANGE_FACTOR 4
226#define ADXL313_X_EN NO_OS_BIT(1)
227#define ADXL313_Y_EN NO_OS_BIT(2)
228#define ADXL313_Z_EN NO_OS_BIT(3)
574 uint8_t *entries_no);
586 int16_t *x_raw, int16_t *y_raw, int16_t *z_raw);
625 uint32_t act_thresh_ug,
632 uint32_t inact_thresh_ug,
654 uint8_t inact_thr, uint8_t time_inact_s);
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int adxl313_get_raw_offset(struct adxl313_dev *dev, int32_t *offset_raw, enum adxl313_axis axis)
Definition adxl313.c:685
int adxl313_get_op_mode(struct adxl313_dev *dev, enum adxl313_op_mode *op_mode)
Definition adxl313.c:448
adxl313_int_pol
Enum for selecting interrupt polarity.
Definition adxl313.h:348
@ ADXL313_INT_ACTIVE_HIGH
Definition adxl313.h:349
@ ADXL313_INT_ACTIVE_LOW
Definition adxl313.h:350
bit_action
Enum for selecting Set/Reset bit action.
Definition adxl313.h:357
@ DISABLE_E
Definition adxl313.h:358
@ ENABLE_E
Definition adxl313.h:359
int adxl313_disable_i2c(struct adxl313_dev *dev)
Definition adxl313.c:1420
int adxl313_enable_i2c(struct adxl313_dev *dev)
Definition adxl313.c:1439
int adxl313_inactivity_int_map(struct adxl313_dev *dev, uint8_t int_pin)
Definition adxl313.c:1833
adxl313_range
Enum for selecting range.
Definition adxl313.h:283
@ ADXL313_12G_RANGE
Definition adxl313.h:291
@ ADXL313_1G_RANGE
Definition adxl313.h:285
@ ADXL313_3G_RANGE
Definition adxl313.h:289
@ ADXL313_0_5G_RANGE
Definition adxl313.h:284
@ ADXL313_2G_RANGE
Definition adxl313.h:286
@ ADXL313_200G_RANGE
Definition adxl313.h:292
@ ADXL313_4G_RANGE
Definition adxl313.h:287
@ ADXL313_6G_RANGE
Definition adxl313.h:290
@ ADXL313_1_5G_RANGE
Definition adxl313.h:288
int adxl313_set_range(struct adxl313_dev *dev, enum adxl313_range range)
Definition adxl313.c:2026
int adxl313_get_inact_thr(struct adxl313_dev *dev, uint32_t *inact_thr_ug)
Definition adxl313.c:1101
int adxl313_sleep(struct adxl313_dev *dev, enum adxl313_wake_up_f wake_up_f_hz)
Definition adxl313.c:1607
int adxl313_disable_full_res(struct adxl313_dev *dev)
Definition adxl313.c:1974
int adxl313_set_odr(struct adxl313_dev *dev, enum adxl313_odr odr)
Definition adxl313.c:1357
int adxl313_enable_full_res(struct adxl313_dev *dev)
Definition adxl313.c:1948
int adxl313_set_int_pol(struct adxl313_dev *dev, enum adxl313_int_pol int_pol)
Definition adxl313.c:1925
adxl313_lp_mode
Enum for low power operating mode.
Definition adxl313.h:262
@ ADXL313_LP_MODE_AUTOSLEEP
Definition adxl313.h:265
@ ADXL313_LP_MODE_NONE
Definition adxl313.h:263
@ ADXL313_LP_MODE_ON
Definition adxl313.h:264
int adxl313_conf_act_thr(struct adxl313_dev *dev, uint32_t act_thr_ug)
Definition adxl313.c:978
int adxl313_exit_sleep(struct adxl313_dev *dev)
Definition adxl313.c:1637
int adxl313_get_act_thr(struct adxl313_dev *dev, uint32_t *act_thr_ug)
Definition adxl313.c:1019
int adxl313_set_fifo_mode(struct adxl313_dev *dev, enum adxl313_fifo_mode mode)
Definition adxl313.c:854
int adxl313_set_fifo_samples(struct adxl313_dev *dev, uint8_t samples_no)
Definition adxl313.c:821
int adxl313_set_op_mode(struct adxl313_dev *dev, enum adxl313_op_mode op_mode)
Definition adxl313.c:410
int adxl313_get_odr(struct adxl313_dev *dev, enum adxl313_odr *odr)
Definition adxl313.c:1396
int adxl313_watermark_int_map(struct adxl313_dev *dev, uint8_t int_pin)
Definition adxl313.c:1856
int adxl313_overrun_int_map(struct adxl313_dev *dev, uint8_t int_pin)
Definition adxl313.c:1879
adxl313_resolution
Enum for specifying resolution.
Definition adxl313.h:299
@ ADXL313_13_BIT_RES
Definition adxl313.h:303
@ ADXL313_12_BIT_RES
Definition adxl313.h:302
@ ADXL313_10_BIT_RES
Definition adxl313.h:300
@ ADXL313_11_BIT_RES
Definition adxl313.h:301
int adxl313_set_inactivity_detection(struct adxl313_dev *dev, uint8_t inact_axes, uint8_t inact_ac_dc, uint32_t inact_thresh_ug, uint8_t inact_time, uint8_t int_pin)
Enables the inactivity detection.
Definition adxl313.c:1300
adxl313_odr
Enum for selecting output data rate.
Definition adxl313.h:310
@ ADXL313_ODR_6_25HZ
Definition adxl313.h:311
@ ADXL313_ODR_50HZ
Definition adxl313.h:314
@ ADXL313_ODR_800HZ
Definition adxl313.h:318
@ ADXL313_ODR_400HZ
Definition adxl313.h:317
@ ADXL313_ODR_1600HZ
Definition adxl313.h:319
@ ADXL313_ODR_3200HZ
Definition adxl313.h:320
@ ADXL313_ODR_12_5HZ
Definition adxl313.h:312
@ ADXL313_ODR_100HZ
Definition adxl313.h:315
@ ADXL313_ODR_200HZ
Definition adxl313.h:316
@ ADXL313_ODR_25HZ
Definition adxl313.h:313
int adxl313_conf_int_enable(struct adxl313_dev *dev, union adxl313_int_en_reg_flags en_ctl)
Definition adxl313.c:1665
int adxl313_conf_act_inact_ctl(struct adxl313_dev *dev, union adxl313_act_inact_ctl_flags config)
Definition adxl313.c:1183
int adxl313_conf_int_map(struct adxl313_dev *dev, union adxl313_int_map_reg_flags int_map)
Definition adxl313.c:1770
int adxl313_data_ready_int_map(struct adxl313_dev *dev, uint8_t int_pin)
Definition adxl313.c:1787
int adxl313_activity_int_map(struct adxl313_dev *dev, uint8_t int_pin)
Definition adxl313.c:1810
int adxl313_conf_inact_thr(struct adxl313_dev *dev, uint32_t inact_thr_ug)
Definition adxl313.c:1060
int adxl313_get_full_res_setting(struct adxl313_dev *dev, uint8_t *full_res)
Definition adxl313.c:2002
int adxl313_set_offset(struct adxl313_dev *dev, int32_t offset_ug, enum adxl313_axis axis)
Definition adxl313.c:475
adxl313_comm_type
Enum for communication type.
Definition adxl313.h:244
@ ADXL313_SPI_COMM
Definition adxl313.h:245
@ ADXL313_I2C_COMM
Definition adxl313.h:246
int adxl313_inactivity_int_enable(struct adxl313_dev *dev)
Definition adxl313.c:1725
int adxl313_link_mode_enable(struct adxl313_dev *dev)
Definition adxl313.c:1568
int adxl313_get_raw_xyz(struct adxl313_dev *dev, int16_t *x_raw, int16_t *y_raw, int16_t *z_raw)
Definition adxl313.c:733
int adxl313_conf_time_inact(struct adxl313_dev *dev, uint8_t time_inact_s)
Definition adxl313.c:1138
int adxl313_remove(struct adxl313_dev *dev)
Definition adxl313.c:343
int adxl313_get_xyz(struct adxl313_dev *dev, struct adxl313_frac_repr *x_m_s2, struct adxl313_frac_repr *y_m_s2, struct adxl313_frac_repr *z_m_s2)
Definition adxl313.c:766
int adxl313_inactivity_int_disable(struct adxl313_dev *dev)
Definition adxl313.c:1747
int adxl313_get_time_inact(struct adxl313_dev *dev, uint8_t *time_inact_s)
Definition adxl313.c:1161
int adxl313_get_fifo_data(struct adxl313_dev *dev, uint8_t *entries, struct adxl313_frac_repr *x, struct adxl313_frac_repr *y, struct adxl313_frac_repr *z)
Definition adxl313.c:935
int adxl313_get_offset(struct adxl313_dev *dev, int32_t *offset_ug, enum adxl313_axis axis)
Definition adxl313.c:531
adxl313_type
Enum for device type.
Definition adxl313.h:234
@ ID_ADXL313
Definition adxl313.h:236
@ ID_ADXL312
Definition adxl313.h:235
@ ID_ADXL314
Definition adxl313.h:237
int adxl313_get_conf_act_inact_ctl(struct adxl313_dev *dev, union adxl313_act_inact_ctl_flags *config)
Definition adxl313.c:1206
int adxl313_self_test(struct adxl313_dev *dev)
Definition adxl313.c:2109
int adxl313_get_range(struct adxl313_dev *dev, enum adxl313_range *range)
Definition adxl313.c:2078
adxl313_op_mode
Enum for operating mode.
Definition adxl313.h:253
@ ADXL313_MEAS
Definition adxl313.h:255
@ ADXL313_STDBY
Definition adxl313.h:254
int adxl313_link_mode_disable(struct adxl313_dev *dev)
Definition adxl313.c:1587
int adxl313_set_raw_offset(struct adxl313_dev *dev, int32_t offset_raw, enum adxl313_axis axis)
Definition adxl313.c:591
int adxl313_get_no_of_fifo_entries(struct adxl313_dev *dev, uint8_t *entries_no)
Definition adxl313.c:798
int adxl313_init(struct adxl313_dev **device, struct adxl313_init_param init_param)
Definition adxl313.c:153
adxl313_wake_up_f
Enum for frequency of wake-up events during sleep.
Definition adxl313.h:272
@ ADXL313_WU_2_HZ
Definition adxl313.h:275
@ ADXL313_WU_4_HZ
Definition adxl313.h:274
@ ADXL313_WU_1_HZ
Definition adxl313.h:276
@ ADXL313_WU_8_HZ
Definition adxl313.h:273
int adxl313_set_activity_detection(struct adxl313_dev *dev, uint8_t act_axes, uint8_t act_ac_dc, uint32_t act_thresh_ug, uint8_t int_pin)
Enable the activity detection.
Definition adxl313.c:1238
adxl313_axis
Enum for accelerometer axis.
Definition adxl313.h:327
@ ADXL313_Z_AXIS
Definition adxl313.h:330
@ ADXL313_Y_AXIS
Definition adxl313.h:329
@ ADXL313_X_AXIS
Definition adxl313.h:328
int adxl313_set_low_power_mode(struct adxl313_dev *dev, enum bit_action enable)
Definition adxl313.c:1460
int adxl313_set_autosleep_mode(struct adxl313_dev *dev, enum bit_action enable, uint8_t inact_thr, uint8_t time_inact_s)
Definition adxl313.c:1512
int adxl313_software_reset(struct adxl313_dev *dev)
Definition adxl313.c:366
int adxl313_activity_int_disable(struct adxl313_dev *dev)
Definition adxl313.c:1703
int adxl313_activity_int_enable(struct adxl313_dev *dev)
Definition adxl313.c:1681
adxl313_fifo_mode
Enum for selecting FIFO operating mode.
Definition adxl313.h:337
@ ADXL313_FIFO_MODE
Definition adxl313.h:339
@ ADXL313_TRIGGERED_MODE
Definition adxl313.h:341
@ ADXL313_STREAM_MODE
Definition adxl313.h:340
@ ADXL313_BYPAS_MODE
Definition adxl313.h:338
int adxl313_get_raw_fifo_data(struct adxl313_dev *dev, uint8_t *entries, int16_t *x_raw, int16_t *y_raw, int16_t *z_raw)
Definition adxl313.c:886
int adxl313_get_int_source_reg(struct adxl313_dev *dev, union adxl313_int_src_reg_flags *int_status_flags)
Definition adxl313.c:1902
Header file of I2C Interface.
Header file of SPI Interface.
Header file of utility functions.
Structure holding the flags corresponding to ACT AC/DC and INACT AC/DC Bits.
Definition adxl313.h:442
uint8_t ACT_Z_EN
Definition adxl313.h:447
uint8_t INACT_Z_EN
Definition adxl313.h:443
uint8_t INACT_X_EN
Definition adxl313.h:445
uint8_t INACT_Y_EN
Definition adxl313.h:444
uint8_t ACT_Y_EN
Definition adxl313.h:448
uint8_t ACT_X_EN
Definition adxl313.h:449
uint8_t ACT_AC_EN
Definition adxl313.h:450
uint8_t INACT_AC_EN
Definition adxl313.h:446
Structure holding the flags for ADXL313 interrupt sources.
Definition adxl313.h:400
uint8_t reserved1
Definition adxl313.h:406
uint8_t INACTIVITY
Definition adxl313.h:404
uint8_t reserved
Definition adxl313.h:403
uint8_t OVERRUN
Definition adxl313.h:401
uint8_t DATA_READY
Definition adxl313.h:407
uint8_t ACTIVITY
Definition adxl313.h:405
uint8_t WATERMARK
Definition adxl313.h:402
ADXL313 Device structure.
Definition adxl313.h:478
enum adxl313_lp_mode lp_mode
Definition adxl313.h:492
union adxl313_act_inact_ctl_flags act_inact_ctl
Definition adxl313.h:517
uint8_t x_offset_raw
Definition adxl313.h:497
enum adxl313_fifo_mode fifo_mode
Definition adxl313.h:507
enum adxl313_comm_type comm_type
Definition adxl313.h:482
enum adxl313_range range
Definition adxl313.h:486
uint8_t time_inact
Definition adxl313.h:515
uint8_t fifo_samples
Definition adxl313.h:509
enum adxl313_type dev_type
Definition adxl313.h:484
enum adxl313_resolution resolution
Definition adxl313.h:488
int64_t scale_factor_mult
Definition adxl313.h:505
uint8_t act_thr
Definition adxl313.h:511
enum adxl313_odr odr
Definition adxl313.h:494
uint8_t y_offset_raw
Definition adxl313.h:500
enum adxl313_op_mode op_mode
Definition adxl313.h:490
uint8_t z_offset_raw
Definition adxl313.h:503
uint8_t comm_buff[24]
Definition adxl313.h:519
uint8_t inact_thr
Definition adxl313.h:513
union adxl313_comm_desc com_desc
Definition adxl313.h:480
Data format in which the acceleration values are converted.
Definition adxl313.h:378
int64_t integer
Definition adxl313.h:379
int32_t fractional
Definition adxl313.h:380
Structure holding the parameters for ADXL313 device initialization.
Definition adxl313.h:387
enum adxl313_type dev_type
Definition adxl313.h:393
union adxl313_comm_init_param comm_init
Definition adxl313.h:389
enum adxl313_comm_type comm_type
Definition adxl313.h:391
Definition ad9361_util.h:63
Structure holding I2C address descriptor.
Definition no_os_i2c.h:89
Structure holding the parameters for I2C initialization.
Definition no_os_i2c.h:52
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128
Union holding the flags corresponding to ACT AC/DC and INACT AC/DC Bits.
Definition adxl313.h:458
uint8_t value
Definition adxl313.h:460
struct _adxl313_act_inact_ctl_flags fields
Definition adxl313.h:459
Union holding the communication parameters.
Definition adxl313.h:467
struct no_os_spi_desc * spi_desc
Definition adxl313.h:471
struct no_os_i2c_desc * i2c_desc
Definition adxl313.h:469
Structure holding the parameters for ADXL313 communication initialization.
Definition adxl313.h:367
struct no_os_i2c_init_param i2c_init
Definition adxl313.h:369
struct no_os_spi_init_param spi_init
Definition adxl313.h:371
Union holding the flags for ADXL313 interrupt enable.
Definition adxl313.h:414
uint8_t value
Definition adxl313.h:416
struct _adxl313_int_reg_flags fields
Definition adxl313.h:415
Union holding the flags for ADXL313 interrupt mapping.
Definition adxl313.h:423
uint8_t value
Definition adxl313.h:425
struct _adxl313_int_reg_flags fields
Definition adxl313.h:424
Union holding the flags for ADXL313 interrupt source.
Definition adxl313.h:432
uint8_t value
Definition adxl313.h:434
struct _adxl313_int_reg_flags fields
Definition adxl313.h:433