43#define ADXL355_SPI_READ 0x01
44#define ADXL355_SPI_WRITE 0x00
45#define ADXL355_ADDR(x) ((x) & 0xFF)
46#define GET_ADXL355_TRANSF_LEN(x) (((x) >> 8) & 0x0000FF)
47#define SET_ADXL355_TRANSF_LEN(x) (((x) << 8) & 0x00FF00)
48#define GET_ADXL355_RESET_VAL(x) (((x) >> 16) & 0x0000FF)
49#define SET_ADXL355_RESET_VAL(x) (((x) << 16) & 0xFF0000)
52#define ADXL355_DEVID_AD (ADXL355_ADDR(0x00) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xAD))
53#define ADXL355_DEVID_MST (ADXL355_ADDR(0x01) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x1D))
54#define ADXL355_PARTID (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xED))
55#define ADXL359_PARTID (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xE9))
56#define ADXL355_REVID (ADXL355_ADDR(0x03) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))
57#define ADXL355_STATUS (ADXL355_ADDR(0x04) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
58#define ADXL355_FIFO_ENTRIES (ADXL355_ADDR(0x05) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
59#define ADXL355_TEMP (ADXL355_ADDR(0x06) | SET_ADXL355_TRANSF_LEN(2))
60#define ADXL355_XDATA (ADXL355_ADDR(0x08) | SET_ADXL355_TRANSF_LEN(3))
61#define ADXL355_YDATA (ADXL355_ADDR(0x0B) | SET_ADXL355_TRANSF_LEN(3))
62#define ADXL355_ZDATA (ADXL355_ADDR(0x0E) | SET_ADXL355_TRANSF_LEN(3))
63#define ADXL355_FIFO_DATA (ADXL355_ADDR(0x11) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
64#define ADXL355_OFFSET_X (ADXL355_ADDR(0x1E) | SET_ADXL355_TRANSF_LEN(2))
65#define ADXL355_OFFSET_Y (ADXL355_ADDR(0x20) | SET_ADXL355_TRANSF_LEN(2))
66#define ADXL355_OFFSET_Z (ADXL355_ADDR(0x22) | SET_ADXL355_TRANSF_LEN(2))
67#define ADXL355_ACT_EN (ADXL355_ADDR(0x24) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
68#define ADXL355_ACT_THRESH (ADXL355_ADDR(0x25) | SET_ADXL355_TRANSF_LEN(2))
69#define ADXL355_ACT_CNT (ADXL355_ADDR(0x27) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))
70#define ADXL355_FILTER (ADXL355_ADDR(0x28) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
71#define ADXL355_FIFO_SAMPLES (ADXL355_ADDR(0x29) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x60))
72#define ADXL355_INT_MAP (ADXL355_ADDR(0x2A) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
73#define ADXL355_SYNC (ADXL355_ADDR(0x2B) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
74#define ADXL355_RANGE (ADXL355_ADDR(0x2C) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x81))
75#define ADXL355_POWER_CTL (ADXL355_ADDR(0x2D) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))
76#define ADXL355_SELF_TEST (ADXL355_ADDR(0x2E) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
77#define ADXL355_RESET (ADXL355_ADDR(0x2F) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
79#define ADXL355_SHADOW_REGISTER_BASE_ADDR (ADXL355_ADDR(0x50) | SET_ADXL355_TRANSF_LEN(5))
80#define ADXL355_MAX_FIFO_SAMPLES_VAL 0x60
81#define ADXL355_SELF_TEST_TRIGGER_VAL 0x03
82#define ADXL355_RESET_CODE 0x52
90#define ADXL355_ACC_SCALE_FACTOR_MUL (int64_t) 38245
91#define ADXL355_ACC_SCALE_FACTOR_DIV (int32_t)1000000000
99#define ADXL359_ACC_SCALE_FACTOR_MUL (int64_t) 191229
100#define ADXL359_ACC_SCALE_FACTOR_DIV (int32_t)1000000000
111#define ADXL355_TEMP_OFFSET -211125
112#define ADXL355_TEMP_OFFSET_DIV 100
118#define ADXL355_TEMP_SCALE_FACTOR -110497238
119#define ADXL355_TEMP_SCALE_FACTOR_DIV 1000000
130#define ADXL359_TEMP_OFFSET -207825
131#define ADXL359_TEMP_OFFSET_DIV 100
137#define ADXL359_TEMP_SCALE_FACTOR -110497238
138#define ADXL359_TEMP_SCALE_FACTOR_DIV 1000000
140#define ADXL355_NEG_ACC_MSK NO_OS_GENMASK(31, 20)
141#define ADXL355_RANGE_FIELD_MSK NO_OS_GENMASK( 1, 0)
142#define ADXL355_ODR_LPF_FIELD_MSK NO_OS_GENMASK( 3, 0)
143#define ADXL355_HPF_FIELD_MSK NO_OS_GENMASK( 6, 4)
144#define ADXL355_INT_POL_FIELD_MSK NO_OS_BIT(6)
338 uint16_t y_offset, uint16_t z_offset);
342 uint32_t *raw_y, uint32_t *raw_z);
366 uint32_t *raw_x, uint32_t *raw_y, uint32_t *raw_z);
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int adxl355_set_range(struct adxl355_dev *dev, enum adxl355_range range_val)
Sets the measurement range register value.
Definition adxl355.c:343
int adxl355_set_odr_lpf(struct adxl355_dev *dev, enum adxl355_odr_lpf odr_lpf_val)
Writes the low-pass filter settings.
Definition adxl355.c:374
adxl355_int_pol
Definition adxl355.h:201
@ ADXL355_INT_ACTIVE_HIGH
Definition adxl355.h:203
@ ADXL355_INT_ACTIVE_LOW
Definition adxl355.h:202
int adxl355_get_op_mode(struct adxl355_dev *dev, enum adxl355_op_mode *read_op_mode)
Gets the current operation mode of the device.
Definition adxl355.c:261
int adxl355_get_xyz(struct adxl355_dev *dev, struct adxl355_frac_repr *x, struct adxl355_frac_repr *y, struct adxl355_frac_repr *z)
Reads the raw output data of each axis and converts it to g.
Definition adxl355.c:559
int adxl355_get_fifo_data(struct adxl355_dev *dev, uint8_t *fifo_entries, struct adxl355_frac_repr *x, struct adxl355_frac_repr *y, struct adxl355_frac_repr *z)
Reads fifo data and returns the values converted in m/s^2.
Definition adxl355.c:757
int adxl355_remove(struct adxl355_dev *dev)
Free the resources allocated by adxl355_init().
Definition adxl355.c:218
int adxl355_config_int_pins(struct adxl355_dev *dev, union adxl355_int_mask int_conf)
Configures the interrupt map for INT1 and INT2 pins.
Definition adxl355.c:857
int adxl355_set_act_cnt_reg(struct adxl355_dev *dev, uint8_t act_cnt)
Writes the activity count register value.
Definition adxl355.c:838
int adxl355_set_op_mode(struct adxl355_dev *dev, enum adxl355_op_mode op_mode)
Places the device into the given operation mode.
Definition adxl355.c:240
int adxl355_get_raw_temp(struct adxl355_dev *dev, uint16_t *raw_temp)
Reads the raw temperature.
Definition adxl355.c:589
int adxl355_set_int_pol(struct adxl355_dev *dev, enum adxl355_int_pol int_pol)
Sets the interrupt polarity.
Definition adxl355.c:874
int adxl355_conf_act_en(struct adxl355_dev *dev, union adxl355_act_en_flags act_config)
Configures the activity enable register.
Definition adxl355.c:793
adxl355_range
Definition adxl355.h:192
@ ADXL359_RANGE_40G
Definition adxl355.h:198
@ ADXL359_RANGE_20G
Definition adxl355.h:196
@ ADXL355_RANGE_2G
Definition adxl355.h:193
@ ADXL359_RANGE_10G
Definition adxl355.h:194
@ ADXL355_RANGE_8G
Definition adxl355.h:197
@ ADXL355_RANGE_4G
Definition adxl355.h:195
adxl355_hpf_corner
Definition adxl355.h:168
@ ADXL355_HPF_0_0954
Definition adxl355.h:174
@ ADXL355_HPF_24_7
Definition adxl355.h:170
@ ADXL355_HPF_0_3862
Definition adxl355.h:173
@ ADXL355_HPF_1_5545
Definition adxl355.h:172
@ ADXL355_HPF_OFF
Definition adxl355.h:169
@ ADXL355_HPF_6_2084
Definition adxl355.h:171
@ ADXL355_HPF_0_0238
Definition adxl355.h:175
int adxl355_set_hpf_corner(struct adxl355_dev *dev, enum adxl355_hpf_corner hpf_corner_val)
Writes the high-pass filter settings.
Definition adxl355.c:425
int adxl355_conf_act_thr(struct adxl355_dev *dev, uint16_t act_thr)
Configures the activity threshold registers.
Definition adxl355.c:816
int adxl355_soft_reset(struct adxl355_dev *dev)
Performs a soft reset of the device.
Definition adxl355.c:282
int adxl355_init(struct adxl355_dev **device, struct adxl355_init_param init_param)
Initializes the communication peripheral and checks if the ADXL355 part is present.
Definition adxl355.c:125
int adxl355_get_raw_fifo_data(struct adxl355_dev *dev, uint8_t *fifo_entries, uint32_t *raw_x, uint32_t *raw_y, uint32_t *raw_z)
Reads fifo data and returns the raw values.
Definition adxl355.c:713
int adxl355_get_raw_xyz(struct adxl355_dev *dev, uint32_t *raw_x, uint32_t *raw_y, uint32_t *raw_z)
Reads the raw output data.
Definition adxl355.c:520
adxl355_op_mode
Definition adxl355.h:152
@ ADXL355_STDBY_TEMP_OFF_DRDY_ON
Definition adxl355.h:156
@ ADXL355_STDBY_TEMP_ON_DRDY_OFF
Definition adxl355.h:158
@ ADXL355_MEAS_TEMP_ON_DRDY_OFF
Definition adxl355.h:157
@ ADXL355_STDBY_TEMP_ON_DRDY_ON
Definition adxl355.h:154
@ ADXL355_STDBY_TEMP_OFF_DRDY_OFF
Definition adxl355.h:160
@ ADXL355_MEAS_TEMP_OFF_DRDY_OFF
Definition adxl355.h:159
@ ADXL355_MEAS_TEMP_ON_DRDY_ON
Definition adxl355.h:153
@ ADXL355_MEAS_TEMP_OFF_DRDY_ON
Definition adxl355.h:155
int adxl355_get_temp(struct adxl355_dev *dev, struct adxl355_frac_repr *temp)
Reads the raw temperature data and converts it to millidegrees Celsius.
Definition adxl355.c:613
int adxl355_set_fifo_samples(struct adxl355_dev *dev, uint8_t reg_value)
Sets the number of FIFO samples register value.
Definition adxl355.c:686
adxl355_type
Definition adxl355.h:146
@ ID_ADXL355
Definition adxl355.h:147
@ ID_ADXL357
Definition adxl355.h:148
@ ID_ADXL359
Definition adxl355.h:149
adxl355_odr_lpf
Definition adxl355.h:178
@ ADXL355_ODR_7_813HZ
Definition adxl355.h:188
@ ADXL355_ODR_3_906HZ
Definition adxl355.h:189
@ ADXL355_ODR_500HZ
Definition adxl355.h:182
@ ADXL355_ODR_1000HZ
Definition adxl355.h:181
@ ADXL355_ODR_62_5HZ
Definition adxl355.h:185
@ ADXL355_ODR_15_625HZ
Definition adxl355.h:187
@ ADXL355_ODR_2000HZ
Definition adxl355.h:180
@ ADXL355_ODR_125HZ
Definition adxl355.h:184
@ ADXL355_ODR_4000HZ
Definition adxl355.h:179
@ ADXL355_ODR_31_25HZ
Definition adxl355.h:186
@ ADXL355_ODR_250HZ
Definition adxl355.h:183
int adxl355_get_sts_reg(struct adxl355_dev *dev, union adxl355_sts_reg_flags *status_flags)
Reads the status register value.
Definition adxl355.c:649
adxl355_comm_type
Definition adxl355.h:163
@ ADXL355_I2C_COMM
Definition adxl355.h:165
@ ADXL355_SPI_COMM
Definition adxl355.h:164
int adxl355_get_nb_of_fifo_entries(struct adxl355_dev *dev, uint8_t *reg_value)
Reads the number of FIFO entries register value.
Definition adxl355.c:672
int adxl355_set_offset(struct adxl355_dev *dev, uint16_t x_offset, uint16_t y_offset, uint16_t z_offset)
Sets an offset value for each axis (Offset Calibration).
Definition adxl355.c:477
int adxl355_set_self_test(struct adxl355_dev *dev)
Triggers the self-test feature.
Definition adxl355.c:327
Header file of I2C Interface.
Header file of SPI Interface.
Header file of utility functions.
uint8_t reserved
Definition adxl355.h:260
uint8_t ACT_X
Definition adxl355.h:257
uint8_t ACT_Z
Definition adxl355.h:259
uint8_t ACT_Y
Definition adxl355.h:258
uint8_t RDY_EN2
Definition adxl355.h:231
uint8_t RDY_EN1
Definition adxl355.h:227
uint8_t ACT_EN1
Definition adxl355.h:230
uint8_t OVR_EN1
Definition adxl355.h:229
uint8_t FULL_EN1
Definition adxl355.h:228
uint8_t FULL_EN2
Definition adxl355.h:232
uint8_t OVR_EN2
Definition adxl355.h:233
uint8_t ACT_EN2
Definition adxl355.h:234
uint8_t FIFO_FULL
Definition adxl355.h:244
uint8_t NVM_BUSY
Definition adxl355.h:247
uint8_t FIFO_OVR
Definition adxl355.h:245
uint8_t DATA_RDY
Definition adxl355.h:243
uint8_t Activity
Definition adxl355.h:246
uint8_t reserved
Definition adxl355.h:248
ADXL355 Device structure.
Definition adxl355.h:284
uint16_t y_offset
Definition adxl355.h:296
union adxl355_act_en_flags act_en
Definition adxl355.h:299
uint8_t act_cnt
Definition adxl355.h:300
enum adxl355_comm_type comm_type
Definition adxl355.h:290
uint16_t x_offset
Definition adxl355.h:295
enum adxl355_type dev_type
Definition adxl355.h:286
uint8_t fifo_samples
Definition adxl355.h:298
uint8_t comm_buff[289]
Definition adxl355.h:302
union adxl355_comm_desc com_desc
Definition adxl355.h:288
uint16_t z_offset
Definition adxl355.h:297
uint16_t act_thr
Definition adxl355.h:301
enum adxl355_range range
Definition adxl355.h:294
enum adxl355_odr_lpf odr_lpf
Definition adxl355.h:292
enum adxl355_hpf_corner hpf_corner
Definition adxl355.h:293
enum adxl355_op_mode op_mode
Definition adxl355.h:291
int32_t fractional
Definition adxl355.h:270
int64_t integer
Definition adxl355.h:269
Structure holding the parameters for ADXL355 device initialization.
Definition adxl355.h:217
union adxl355_comm_init_param comm_init
Definition adxl355.h:219
enum adxl355_type dev_type
Definition adxl355.h:223
enum adxl355_comm_type comm_type
Definition adxl355.h:221
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
uint8_t value
Definition adxl355.h:265
struct _adxl355_act_en_flags fields
Definition adxl355.h:264
struct no_os_spi_desc * spi_desc
Definition adxl355.h:277
struct no_os_i2c_desc * i2c_desc
Definition adxl355.h:275
struct no_os_spi_init_param spi_init
Definition adxl355.h:210
struct no_os_i2c_init_param i2c_init
Definition adxl355.h:208
uint8_t value
Definition adxl355.h:239
struct _adxl355_int_mask fields
Definition adxl355.h:238
struct _adxl355_sts_reg_flags fields
Definition adxl355.h:252
uint8_t value
Definition adxl355.h:253