no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
adxl367.h
Go to the documentation of this file.
1/***************************************************************************/
33
34#ifndef __ADXL367_H__
35#define __ADXL367_H__
36
37#include <stdint.h>
38#include <stdbool.h>
39#include "no_os_spi.h"
40#include "no_os_i2c.h"
41
42/* ADXL367 communication commands */
43#define ADXL367_WRITE_REG 0x0A
44#define ADXL367_READ_REG 0x0B
45#define ADXL367_READ_FIFO 0x0D
46#define ADXL367_I2C_READ 0x01
47#define ADXL367_I2C_WRITE 0x00
48
49/* Registers */
50#define ADXL367_REG_DEVID_AD 0x00
51#define ADXL367_REG_DEVID_MST 0x01
52#define ADXL367_REG_PARTID 0x02
53#define ADXL367_REG_REVID 0x03
54#define ADXL367_REG_SERIAL_NUMBER_3 0x04
55#define ADXL367_REG_SERIAL_NUMBER_2 0x05
56#define ADXL367_REG_SERIAL_NUMBER_1 0x06
57#define ADXL367_REG_SERIAL_NUMBER_0 0x07
58#define ADXL367_REG_XDATA 0x08
59#define ADXL367_REG_YDATA 0x09
60#define ADXL367_REG_ZDATA 0x0A
61#define ADXL367_REG_STATUS 0x0B
62#define ADXL367_REG_FIFO_ENTRIES_L 0x0C
63#define ADXL367_REG_FIFO_ENTRIES_H 0x0D
64#define ADXL367_REG_XDATA_H 0x0E
65#define ADXL367_REG_XDATA_L 0x0F
66#define ADXL367_REG_YDATA_H 0x10
67#define ADXL367_REG_YDATA_L 0x11
68#define ADXL367_REG_ZDATA_H 0x12
69#define ADXL367_REG_ZDATA_L 0x13
70#define ADXL367_REG_TEMP_H 0x14
71#define ADXL367_REG_TEMP_L 0x15
72#define ADXL367_REG_EX_ADC_H 0x16
73#define ADXL367_REG_EX_ADC_L 0x17
74#define ADXL367_REG_I2C_FIFO_DATA 0x18
75#define ADXL367_REG_SOFT_RESET 0x1F
76#define ADXL367_REG_THRESH_ACT_H 0x20
77#define ADXL367_REG_THRESH_ACT_L 0x21
78#define ADXL367_REG_TIME_ACT 0x22
79#define ADXL367_REG_THRESH_INACT_H 0x23
80#define ADXL367_REG_THRESH_INACT_L 0x24
81#define ADXL367_REG_TIME_INACT_H 0x25
82#define ADXL367_REG_TIME_INACT_L 0x26
83#define ADXL367_REG_ACT_INACT_CTL 0x27
84#define ADXL367_REG_FIFO_CONTROL 0x28
85#define ADXL367_REG_FIFO_SAMPLES 0x29
86#define ADXL367_REG_INTMAP1_LWR 0x2A
87#define ADXL367_REG_INTMAP2_LWR 0x2B
88#define ADXL367_REG_FILTER_CTL 0x2C
89#define ADXL367_REG_POWER_CTL 0x2D
90#define ADXL367_REG_SELF_TEST 0x2E
91#define ADXL367_REG_TAP_THRESH 0x2F
92#define ADXL367_REG_TAP_DUR 0x30
93#define ADXL367_REG_TAP_LATENT 0x31
94#define ADXL367_REG_TAP_WINDOW 0x32
95#define ADXL367_REG_X_OFFSET 0x33
96#define ADXL367_REG_Y_OFFSET 0x34
97#define ADXL367_REG_Z_OFFSET 0x35
98#define ADXL367_REG_X_SENS 0x36
99#define ADXL367_REG_Y_SENS 0x37
100#define ADXL367_REG_Z_SENS 0x38
101#define ADXL367_REG_TIMER_CTL 0x39
102#define ADXL367_REG_INTMAP1_UPPER 0x3A
103#define ADXL367_REG_INTMAP2_UPPER 0x3B
104#define ADXL367_REG_ADC_CTL 0x3C
105#define ADXL367_REG_TEMP_CTL 0x3D
106#define ADXL367_REG_TEMP_ADC_OV_TH_H 0x3E
107#define ADXL367_REG_TEMP_ADC_OV_TH_L 0x3F
108#define ADXL367_REG_TEMP_ADC_UN_TH_H 0x40
109#define ADXL367_REG_TEMP_ADC_UN_TH_L 0x41
110#define ADXL367_REG_TEMP_ADC_TIMER 0x42
111#define ADXL367_REG_AXIS_MASK 0x43
112#define ADXL367_REG_STATUS_COPY 0x44
113#define ADXL367_REG_STATUS_2 0x45
114
115/* ADXL367_REG_STATUS definitions */
116#define ADXL367_STATUS_ERR_USER_REGS NO_OS_BIT(7)
117#define ADXL367_STATUS_AWAKE NO_OS_BIT(6)
118#define ADXL367_STATUS_INACT NO_OS_BIT(5)
119#define ADXL367_STATUS_ACT NO_OS_BIT(4)
120#define ADXL367_STATUS_FIFO_OVERRUN NO_OS_BIT(3)
121#define ADXL367_STATUS_FIFO_WATERMARK NO_OS_BIT(2)
122#define ADXL367_STATUS_FIFO_RDY NO_OS_BIT(1)
123#define ADXL367_STATUS_DATA_RDY NO_OS_BIT(0)
124
125/* ADXL367_REG_THRESH_H mask */
126#define ADXL367_THRESH_H 0x7F
127
128/* ADXL367_REG_THRESH_L mask */
129#define ADXL367_THRESH_L 0xFC
130
131/* ADXL367_REG_ACT_INACT_CTL definitions */
132#define ADXL367_ACT_INACT_CTL_LINKLOOP_MSK NO_OS_GENMASK(5, 4)
133#define ADXL367_ACT_INACT_CTL_INACT_EN_MSK NO_OS_GENMASK(3, 2)
134#define ADXL367_ACT_INACT_CTL_ACT_EN_MSK NO_OS_GENMASK(1, 0)
135
136/* ADXL367_ACT_INACT_CTL_INACT_EN(x) options */
137#define ADXL367_NO_INACTIVITY_DETECTION_ENABLED 0x0
138#define ADXL367_INACTIVITY_ENABLE 0x1
139#define ADXL367_NO_INACTIVITY_DETECTION_ENABLED_2 0x2
140#define ADXL367_REFERENCED_INACTIVITY_ENABLE 0x3
141
142/* ADXL367_ACT_INACT_CTL_ACT_EN(x) options */
143#define ADXL367_NO_ACTIVITY_DETECTION 0x0
144#define ADXL367_ACTIVITY_ENABLE 0x1
145#define ADXL367_NO_ACTIVITY_DETECTION_2 0x2
146#define ADXL367_REFERENCED_ACTIVITY_ENABLE 0x3
147
148/* ADXL367_REG_FIFO_CONTROL */
149#define ADXL367_FIFO_CONTROL_FIFO_CHANNEL_MSK NO_OS_GENMASK(6, 3)
150#define ADXL367_FIFO_CONTROL_FIFO_SAMPLES NO_OS_BIT(2)
151#define ADXL367_FIFO_CONTROL_FIFO_MODE_MSK NO_OS_GENMASK(1, 0)
152
153/* ADXL367_FIFO_CONTROL_FIFO_CHANNEL(x) options */
154#define ADXL367_ALL_AXIS 0x0
155#define ADXL367_X_AXIS 0x1
156#define ADXL367_Y_AXIS 0x2
157#define ADXL367_X_AXIS_2 0x3
158#define ADXL367_ALL_AXIS_TEMP 0x4
159#define ADXL367_X_AXIS_TEMP 0x5
160#define ADXL367_Y_AXIS_TEMP 0x6
161#define ADXL367_Z_AXIS_TEMP 0x7
162#define ADXL367_ALL_AXIS_EXT_ADC 0x8
163#define ADXL367_X_AXIS_EXT_ADC 0x9
164#define ADXL367_Y_AXIS_EXT_ADC 0xA
165#define ADXL367_Z_AXIS_EXT_ADC 0xB
166
167/* ADXL367_FIFO_CONTROL_FIFO_MODE(x) options */
168#define ADXL367_FIFO_DISABLE 0
169#define ADXL367_FIFO_OLDEST_SAVED 1
170#define ADXL367_FIFO_STREAM 2
171#define ADXL367_FIFO_TRIGGERED 3
172
173/* ADXL367_REG_INTMAP1_LOWER */
174#define ADXL367_INTMAP1_INT_LOW_INT1 NO_OS_BIT(7)
175#define ADXL367_INTMAP1_AWAKE_INT1 NO_OS_BIT(6)
176#define ADXL367_INTMAP1_INACT_INT1 NO_OS_BIT(5)
177#define ADXL367_INTMAP1_ACT_INT1 NO_OS_BIT(4)
178#define ADXL367_INTMAP1_FIFO_OVERRUN_INT1 NO_OS_BIT(3)
179#define ADXL367_INTMAP1_FIFO_WATERMARK_INT1 NO_OS_BIT(2)
180#define ADXL367_INTMAP1_FIFO_RDY_INT1 NO_OS_BIT(1)
181#define ADXL367_INTMAP1_DATA_RDY_INT1 NO_OS_BIT(0)
182
183/* ADXL367_REG_INTMAP2_LOWER definitions */
184#define ADXL367_INTMAP2_INT_LOW_INT2 NO_OS_BIT(7)
185#define ADXL367_INTMAP2_AWAKE_INT2 NO_OS_BIT(6)
186#define ADXL367_INTMAP2_INACT_INT2 NO_OS_BIT(5)
187#define ADXL367_INTMAP2_ACT_INT2 NO_OS_BIT(4)
188#define ADXL367_INTMAP2_FIFO_OVERRUN_INT2 NO_OS_BIT(3)
189#define ADXL367_INTMAP2_FIFO_WATERMARK_INT2 NO_OS_BIT(2)
190#define ADXL367_INTMAP2_FIFO_RDY_INT2 NO_OS_BIT(1)
191#define ADXL367_INTMAP2_DATA_RDY_INT2 NO_OS_BIT(0)
192
193/* ADXL367_REG_FILTER_CTL definitions */
194#define ADXL367_FILTER_CTL_RANGE_MSK NO_OS_GENMASK(7, 6)
195#define ADXL367_FILTER_I2C_HS NO_OS_BIT(5)
196#define ADXL367_FILTER_CTL_RES NO_OS_BIT(4)
197#define ADXL367_FILTER_CTL_EXT_SAMPLE NO_OS_BIT(3)
198#define ADXL367_FILTER_CTL_ODR_MSK NO_OS_GENMASK(2, 0)
199
200/* ADXL367_FILTER_CTL_RANGE(x) options */
201#define ADXL367_RANGE_2G 0 /* +/-2 g */
202#define ADXL367_RANGE_4G 1 /* +/-4 g */
203#define ADXL367_RANGE_8G 2 /* +/-8 g */
204
205/* ADXL367_REG_POWER_CTL definitions */
206#define ADXL367_POWER_CTL_RES NO_OS_BIT(7)
207#define ADXL367_POWER_CTL_EXT_CLK NO_OS_BIT(6)
208#define ADXL367_POWER_CTL_LOW_NOISE_MSK NO_OS_GENMASK(5, 4)
209#define ADXL367_POWER_CTL_WAKEUP NO_OS_BIT(3)
210#define ADXL367_POWER_CTL_AUTOSLEEP NO_OS_BIT(2)
211#define ADXL367_POWER_CTL_MEASURE_MSK NO_OS_GENMASK(1, 0)
212
213/* ADXL367_POWER_CTL_NOISE(x) options */
214#define ADXL367_NOISE_MODE_NORMAL 0
215#define ADXL367_NOISE_MODE_LOW 1
216#define ADXL367_NOISE_MODE_ULTRALOW 2
217
218/* ADXL367_REG_SELF_TEST */
219#define ADXL367_SELF_TEST_ST_FORCE NO_OS_BIT(1)
220#define ADXL367_SELF_TEST_ST NO_OS_BIT(0)
221
222/* XYZ_AXIS_OFFSET MASK */
223#define ADXL367_XYZ_AXIS_OFFSET_MASK 0x1F
224
225/* ADXL367_REG_INTMAPX_UPPER MASK */
226#define ADXL367_INTMAPX_UPPER_MASK 0xDF
227
228/* ADXL367_REG_ADC_CTL definitions. */
229#define ADXL367_FIFO_8_12BIT_MSK NO_OS_GENMASK(7,6)
230#define ADXL367_ADC_INACT_EN NO_OS_BIT(3)
231#define ADXL367_ADC_ACT_EN NO_OS_BIT(1)
232#define ADXL367_ADC_EN NO_OS_BIT(0)
233
234/* ADXL367_REG_TEMP_CTL definitions. */
235#define ADXL367_TEMP_INACT_EN NO_OS_BIT(3)
236#define ADXL367_TEMP_ACT_EN NO_OS_BIT(1)
237#define ADXL367_TEMP_EN NO_OS_BIT(0)
238
239/* ADXL367 device information */
240#define ADXL367_DEVICE_AD 0xAD
241#define ADXL367_DEVICE_MST 0x1D
242#define ADXL367_PART_ID 0xF7
243
244/* ADXL367 Reset settings */
245#define ADXL367_RESET_KEY 0x52
246
247/* Channel ID for FIFO read */
248#define ADXL367_FIFO_X_ID 0x00
249#define ADXL367_FIFO_Y_ID 0x01
250#define ADXL367_FIFO_Z_ID 0x02
251#define ADXL367_FIFO_TEMP_ADC_ID 0x03
252
253#define ADXL367_ABSOLUTE 0x00
254#define ADXL367_REFERENCED 0x01
255
256/*
257 * At +/- 2g with 14-bit resolution, scale is given in datasheet as
258 * 250ug/LSB = 0.0002500 * 9.80665 = 0.0024516625 m/s^2.
259 * For +/- 4g range a multiplier with value 2 is used.
260 * For +/-8g range, a multiplier with value 4 is used.
261 */
262#define ADXL367_ACC_SCALE_FACTOR_MUL 245166ULL
263#define ADXL367_ACC_SCALE_FACTOR_DIV 1000000000
264
265/*
266 * At 25C, raw value is equal to 165 LSB. Raw value varies with 54LSB/C.
267 * Offset = 25 * ADXL367_TEMP_PER_C - ADXL367_TEMP_25C = 1185.
268 * Temp = (RAW + OFFSET) * SCALE
269 * */
270#define ADXL367_TEMP_OFFSET 1185
271#define ADXL367_TEMP_25C 165
272#define ADXL367_TEMP_SCALE 18518518
273#define ADXL367_TEMP_SCALE_DIV 1000000000
274
275/* Min change = 90mg. Sensitivity = 4LSB / mg */
276#define ADXL367_SELF_TEST_MIN 90 * 100 / 25
277/* Max change = 270mg. Sensitivity = 4LSB / mg */
278#define ADXL367_SELF_TEST_MAX 270 * 100 / 25
279
288
297
307
320
331
337 /* All axis. Default mode. */
339 /* X axis. */
341 /* Y axis. */
343 /* Z axis. */
345 /* All axis + temperature. */
347 /* X axis + temperature. */
349 /* Y axis + temperature. */
351 /* Z axis + temperature. */
353 /* All axis + ADC. */
355 /* X axis + ADC. */
357 /* Y axis + ADC. */
359 /* Z axis + ADC. */
361};
362
368 /* Upper 12 bits plus channel ID.*/
370 /* Upper 8 bits, no channel ID. */
372 /* Upper 12 bits, no channel ID. */
374 /* 14 bits plus channel ID. Default mode. */
376};
377
383 uint8_t err_fuse : 1;
384 uint8_t err_user_regs : 1;
385 uint8_t kpalv_timer : 1;
386 uint8_t temp_adc_hi : 1;
387 uint8_t temp_adc_low : 1;
388 uint8_t tap_two : 1;
389 uint8_t tap_one : 1;
390 uint8_t int_low : 1;
391 uint8_t awake : 1;
392 uint8_t inact : 1;
393 uint8_t act : 1;
394 uint8_t fifo_overrun : 1;
395 uint8_t fifo_watermark : 1;
396 uint8_t fifo_ready : 1;
397 uint8_t data_ready : 1;
398};
399
405 int64_t integer;
406 int32_t fractional;
407};
408
435
450
451/* Initializes the device. */
452int adxl367_init(struct adxl367_dev **device,
454
455/* Free the resources allocated by adxl367_init(). */
456int adxl367_remove(struct adxl367_dev *dev);
457
458/* Performs device self-test. */
459int adxl367_self_test(struct adxl367_dev *dev);
460
461/* Writes data into a register. */
463 uint8_t register_value,
464 uint8_t register_address);
465
466/* Performs a burst read of a specified number of registers. */
468 uint8_t *read_data,
469 uint8_t register_address,
470 uint8_t bytes_number);
471
472/* Performs a masked write to a register. */
473int adxl367_reg_write_msk(struct adxl367_dev *dev,
474 uint8_t reg_addr,
475 uint8_t data,
476 uint8_t mask);
477
478/* Resets the device via comm. */
479int adxl367_software_reset(struct adxl367_dev *dev);
480
481/* Places the device into standby/measure mode. */
482int adxl367_set_power_mode(struct adxl367_dev *dev,
483 enum adxl367_op_mode mode);
484
485/* Selects the measurement range. */
486int adxl367_set_range(struct adxl367_dev *dev,
487 enum adxl367_range range);
488
489/* Selects the Output Data Rate of the device. */
491 enum adxl367_odr odr);
492
493/* Sets user defined offset for each axis. */
494int adxl367_set_offset(struct adxl367_dev *dev, uint16_t x_offset,
495 uint16_t y_offset, uint16_t z_offset);
496
497/* Reads the 3-axis raw data from the accelerometer. */
498int adxl367_get_raw_xyz(struct adxl367_dev *dev,
499 int16_t* x,
500 int16_t* y,
501 int16_t* z);
502
503/* Reads the 3-axis raw data from the accelerometer and converts it to g. */
504int adxl367_get_g_xyz(struct adxl367_dev *dev,
505 struct adxl367_fractional_val* x,
506 struct adxl367_fractional_val* y,
507 struct adxl367_fractional_val* z);
508
509/* Enables temperature reading. */
510int adxl367_temp_read_en(struct adxl367_dev *dev, bool enable);
511
512/* Enables adc reading and disables temperature reading. */
513int adxl367_adc_read_en(struct adxl367_dev *dev, bool enable);
514
515/* Reads the raw temperature of the device. */
516int adxl367_read_raw_temp(struct adxl367_dev *dev, int16_t *raw_temp);
517
518/* Reads the temperature of the device. */
520 struct adxl367_fractional_val *temp);
521
522/* Reads ADC data. */
523int adxl367_read_adc(struct adxl367_dev *dev, int16_t *data);
524
525/* Reads the number of FIFO entries register value. */
527 uint16_t *entr_nb);
528
529/* Sets the number of FIFO samples register value. */
531 uint16_t sets_nb);
532
533/* Sets FIFO mode. */
534int adxl367_set_fifo_mode(struct adxl367_dev *dev,
535 enum adxl367_fifo_mode mode);
536
537/* Sets FIFO read mode. */
539 enum adxl367_fifo_read_mode read_mode);
540
541/* Sets FIFO data storage format. */
543 enum adxl367_fifo_format format);
544
545/* Configures FIFO feature. */
546int adxl367_fifo_setup(struct adxl367_dev *dev,
547 enum adxl367_fifo_mode mode,
548 enum adxl367_fifo_format format,
549 uint8_t sets_nb);
550
551/* Reads raw values from FIFO. */
552int adxl367_read_raw_fifo(struct adxl367_dev *dev, int16_t *x, int16_t *y,
553 int16_t *z, int16_t *temp_adc, uint16_t *entries);
554
555/* Reads converted values from FIFO. */
558 struct adxl367_fractional_val *z, struct adxl367_fractional_val *temp_adc,
559 uint16_t *entries);
560
561/* Enables specified events to interrupt pin. */
562int adxl367_int_map(struct adxl367_dev *dev, struct adxl367_int_map *map,
563 uint8_t pin);
564
565/* Configures activity detection. */
567 uint8_t ref_or_abs,
568 uint16_t threshold,
569 uint8_t time);
570
571/* Configures inactivity detection. */
573 uint8_t ref_or_abs,
574 uint16_t threshold,
575 uint16_t time);
576
577#endif /* __ADXL367_H__ */
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
adxl367_fifo_format
Enum for selecting FIFO storage mode.
Definition adxl367.h:336
@ ADXL367_FIFO_FORMAT_Y
Definition adxl367.h:342
@ ADXL367_FIFO_FORMAT_XYZT
Definition adxl367.h:346
@ ADXL367_FIFO_FORMAT_YA
Definition adxl367.h:358
@ ADXL367_FIFO_FORMAT_X
Definition adxl367.h:340
@ ADXL367_FIFO_FORMAT_XA
Definition adxl367.h:356
@ ADXL367_FIFO_FORMAT_XYZA
Definition adxl367.h:354
@ ADXL367_FIFO_FORMAT_ZA
Definition adxl367.h:360
@ ADXL367_FIFO_FORMAT_Z
Definition adxl367.h:344
@ ADXL367_FIFO_FORMAT_ZT
Definition adxl367.h:352
@ ADXL367_FIFO_FORMAT_YT
Definition adxl367.h:350
@ ADXL367_FIFO_FORMAT_XYZ
Definition adxl367.h:338
@ ADXL367_FIFO_FORMAT_XT
Definition adxl367.h:348
int adxl367_set_range(struct adxl367_dev *dev, enum adxl367_range range)
Selects the measurement range.
Definition adxl367.c:455
int adxl367_set_fifo_read_mode(struct adxl367_dev *dev, enum adxl367_fifo_read_mode read_mode)
Sets FIFO read mode.
Definition adxl367.c:902
adxl367_fifo_mode
Enum for selecting FIFO operating mode.
Definition adxl367.h:325
@ ADXL367_FIFO_DISABLED
Definition adxl367.h:326
@ ADXL367_TRIGGERED_MODE
Definition adxl367.h:329
@ ADXL367_STREAM_MODE
Definition adxl367.h:328
@ ADXL367_OLDEST_SAVED
Definition adxl367.h:327
adxl367_range
Enum for selecting range.
Definition adxl367.h:302
@ ADXL367_8G_RANGE
Definition adxl367.h:305
@ ADXL367_2G_RANGE
Definition adxl367.h:303
@ ADXL367_4G_RANGE
Definition adxl367.h:304
int adxl367_set_power_mode(struct adxl367_dev *dev, enum adxl367_op_mode mode)
Places the device into standby/measure mode.
Definition adxl367.c:423
adxl367_odr
Enum for selecting output data rate.
Definition adxl367.h:312
@ ADXL367_ODR_200HZ
Definition adxl367.h:317
@ ADXL367_ODR_12P5HZ
Definition adxl367.h:313
@ ADXL367_ODR_25HZ
Definition adxl367.h:314
@ ADXL367_ODR_50HZ
Definition adxl367.h:315
@ ADXL367_ODR_100HZ
Definition adxl367.h:316
@ ADXL367_ODR_400HZ
Definition adxl367.h:318
int adxl367_fifo_setup(struct adxl367_dev *dev, enum adxl367_fifo_mode mode, enum adxl367_fifo_format format, uint8_t sets_nb)
Configures the FIFO feature. Uses ADXL367_14B_CHID read mode as default.
Definition adxl367.c:1008
int adxl367_self_test(struct adxl367_dev *dev)
Performs self test.
Definition adxl367.c:149
adxl367_comm_type
Enum for communication type.
Definition adxl367.h:284
@ ADXL367_I2C_COMM
Definition adxl367.h:286
@ ADXL367_SPI_COMM
Definition adxl367.h:285
int adxl367_reg_write_msk(struct adxl367_dev *dev, uint8_t reg_addr, uint8_t data, uint8_t mask)
Performs a masked write to a register.
Definition adxl367.c:358
int adxl367_adc_read_en(struct adxl367_dev *dev, bool enable)
Enables ADC reading. Disables temperature reading.
Definition adxl367.c:672
int adxl367_set_offset(struct adxl367_dev *dev, uint16_t x_offset, uint16_t y_offset, uint16_t z_offset)
Sets offset for each axis.
Definition adxl367.c:513
adxl367_fifo_read_mode
Enum for selecting FIFO reading mode.
Definition adxl367.h:367
@ ADXL367_14B_CHID
Definition adxl367.h:375
@ ADXL367_8B
Definition adxl367.h:371
@ ADXL367_12B
Definition adxl367.h:373
@ ADXL367_12B_CHID
Definition adxl367.h:369
int adxl367_read_temperature(struct adxl367_dev *dev, struct adxl367_fractional_val *temp)
Reads the temperature of the device.
Definition adxl367.c:760
int adxl367_init(struct adxl367_dev **device, struct adxl367_init_param init_param)
Initializes communication with the device and checks if the part is present by reading the device id.
Definition adxl367.c:55
int adxl367_set_fifo_format(struct adxl367_dev *dev, enum adxl367_fifo_format format)
Sets FIFO format.
Definition adxl367.c:939
int adxl367_get_g_xyz(struct adxl367_dev *dev, struct adxl367_fractional_val *x, struct adxl367_fractional_val *y, struct adxl367_fractional_val *z)
Reads the 3-axis raw data from the accelerometer and converts it to g.
Definition adxl367.c:625
int adxl367_set_register_value(struct adxl367_dev *dev, uint8_t register_value, uint8_t register_address)
Writes data into a register.
Definition adxl367.c:245
int adxl367_setup_inactivity_detection(struct adxl367_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint16_t time)
Configures inactivity detection.
Definition adxl367.c:1296
int adxl367_software_reset(struct adxl367_dev *dev)
Performs soft-reset.
Definition adxl367.c:381
int adxl367_read_raw_fifo(struct adxl367_dev *dev, int16_t *x, int16_t *y, int16_t *z, int16_t *temp_adc, uint16_t *entries)
Reads all available raw values from FIFO. If, after setting FIFO mode, any of x, y,...
Definition adxl367.c:1045
int adxl367_set_output_rate(struct adxl367_dev *dev, enum adxl367_odr odr)
Selects the Output Data Rate of the device.
Definition adxl367.c:486
int adxl367_read_adc(struct adxl367_dev *dev, int16_t *data)
Reads ADC data. If ADXL367_ADC_EN is not set, use adxl367_adc_read_en() first to enable ADC reading.
Definition adxl367.c:782
int adxl367_set_fifo_mode(struct adxl367_dev *dev, enum adxl367_fifo_mode mode)
Sets FIFO mode.
Definition adxl367.c:873
int adxl367_set_fifo_sample_sets_nb(struct adxl367_dev *dev, uint16_t sets_nb)
Sets the number of FIFO sample sets.
Definition adxl367.c:844
int adxl367_get_nb_of_fifo_entries(struct adxl367_dev *dev, uint16_t *entr_nb)
Reads the number of FIFO entries.
Definition adxl367.c:820
int adxl367_read_converted_fifo(struct adxl367_dev *dev, struct adxl367_fractional_val *x, struct adxl367_fractional_val *y, struct adxl367_fractional_val *z, struct adxl367_fractional_val *temp_adc, uint16_t *entries)
Reads converted values from FIFO. If, after setting FIFO mode, any of x, y, z, temp or adc aren't sel...
Definition adxl367.c:1133
int adxl367_remove(struct adxl367_dev *dev)
Frees the resources allocated by adxl367_init().
Definition adxl367.c:128
int adxl367_int_map(struct adxl367_dev *dev, struct adxl367_int_map *map, uint8_t pin)
Enables specified events to interrupt pin.
Definition adxl367.c:1188
int adxl367_get_raw_xyz(struct adxl367_dev *dev, int16_t *x, int16_t *y, int16_t *z)
Reads the 3-axis raw data from the accelerometer.
Definition adxl367.c:552
int adxl367_setup_activity_detection(struct adxl367_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint8_t time)
Configures activity detection.
Definition adxl367.c:1239
int adxl367_read_raw_temp(struct adxl367_dev *dev, int16_t *raw_temp)
Reads the raw temperature of the device. If ADXL367_TEMP_EN is not set, use adxl367_temp_read_en() fi...
Definition adxl367.c:699
int adxl367_temp_read_en(struct adxl367_dev *dev, bool enable)
Enables temperature reading.
Definition adxl367.c:655
adxl367_op_mode
Enum for operating mode.
Definition adxl367.h:293
@ ADXL367_OP_STANDBY
Definition adxl367.h:294
@ ADXL367_OP_MEASURE
Definition adxl367.h:295
int adxl367_get_register_value(struct adxl367_dev *dev, uint8_t *read_data, uint8_t register_address, uint8_t bytes_number)
Performs a burst read of a specified number of registers.
Definition adxl367.c:274
Header file of I2C Interface.
Header file of SPI Interface.
ADXL367 Device structure.
Definition adxl367.h:413
uint16_t x_offset
Definition adxl367.h:431
enum adxl367_fifo_format fifo_format
Definition adxl367.h:427
enum adxl367_comm_type comm_type
Definition adxl367.h:415
uint16_t y_offset
Definition adxl367.h:432
enum adxl367_odr odr
Definition adxl367.h:425
enum adxl367_op_mode op_mode
Definition adxl367.h:424
uint8_t fifo_buffer[1027]
Definition adxl367.h:430
enum adxl367_fifo_read_mode fifo_read_mode
Definition adxl367.h:428
enum adxl367_fifo_mode fifo_mode
Definition adxl367.h:426
struct no_os_i2c_desc * i2c_desc
Definition adxl367.h:419
uint8_t i2c_slave_address
Definition adxl367.h:421
enum adxl367_range range
Definition adxl367.h:423
struct no_os_spi_desc * spi_desc
Definition adxl367.h:417
uint16_t z_offset
Definition adxl367.h:433
Data format in which the values are converted.
Definition adxl367.h:404
int32_t fractional
Definition adxl367.h:406
int64_t integer
Definition adxl367.h:405
Structure holding the parameters for ADXL367 device initialization.
Definition adxl367.h:440
struct no_os_spi_init_param spi_init
Definition adxl367.h:444
uint8_t i2c_slave_address
Definition adxl367.h:448
enum adxl367_comm_type comm_type
Definition adxl367.h:442
struct no_os_i2c_init_param i2c_init
Definition adxl367.h:446
Contains bit options from INT registers.
Definition adxl367.h:382
uint8_t temp_adc_hi
Definition adxl367.h:386
uint8_t inact
Definition adxl367.h:392
uint8_t data_ready
Definition adxl367.h:397
uint8_t err_user_regs
Definition adxl367.h:384
uint8_t temp_adc_low
Definition adxl367.h:387
uint8_t act
Definition adxl367.h:393
uint8_t tap_two
Definition adxl367.h:388
uint8_t kpalv_timer
Definition adxl367.h:385
uint8_t fifo_ready
Definition adxl367.h:396
uint8_t awake
Definition adxl367.h:391
uint8_t fifo_watermark
Definition adxl367.h:395
uint8_t int_low
Definition adxl367.h:390
uint8_t fifo_overrun
Definition adxl367.h:394
uint8_t tap_one
Definition adxl367.h:389
uint8_t err_fuse
Definition adxl367.h:383
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