42#define CHIP_NAME "Analog Devices ADXL362"
43#define MANUFACTURER_NAME "Analog Devices"
44#define SUPPLY_VOLTAGE_MIN 1.6f
45#define SUPPLY_VOLTAGE_MAX 3.5f
46#define MAX_CURRENT 0.013f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 85.0f
49#define DRIVER_VERSION 1000
54#define ADXL362_REG_DEVID_AD 0x00
55#define ADXL362_REG_DEVID_MST 0x01
56#define ADXL362_REG_PARTID 0x02
57#define ADXL362_REG_REVID 0x03
58#define ADXL362_REG_XDATA 0x08
59#define ADXL362_REG_YDATA 0x09
60#define ADXL362_REG_ZDATA 0x0A
61#define ADXL362_REG_STATUS 0x0B
62#define ADXL362_REG_FIFO_ENTRIES_L 0x0C
63#define ADXL362_REG_FIFO_ENTRIES_H 0x0D
64#define ADXL362_REG_XDATA_L 0x0E
65#define ADXL362_REG_XDATA_H 0x0F
66#define ADXL362_REG_YDATA_L 0x10
67#define ADXL362_REG_YDATA_H 0x11
68#define ADXL362_REG_ZDATA_L 0x12
69#define ADXL362_REG_ZDATA_H 0x13
70#define ADXL362_REG_TEMP_L 0x14
71#define ADXL362_REG_TEMP_H 0x15
72#define ADXL362_REG_SOFT_RESET 0x1F
73#define ADXL362_REG_THRESH_ACT_L 0x20
74#define ADXL362_REG_THRESH_ACT_H 0x21
75#define ADXL362_REG_TIME_ACT 0x22
76#define ADXL362_REG_THRESH_INACT_L 0x23
77#define ADXL362_REG_THRESH_INACT_H 0x24
78#define ADXL362_REG_TIME_INACT_L 0x25
79#define ADXL362_REG_TIME_INACT_H 0x26
80#define ADXL362_REG_ACT_INACT_CTL 0x27
81#define ADXL362_REG_FIFO_CONTROL 0x28
82#define ADXL362_REG_FIFO_SAMPLES 0x29
83#define ADXL362_REG_INTMAP1 0x2A
84#define ADXL362_REG_INTMAP2 0x2B
85#define ADXL362_REG_FILTER_CTL 0x2C
86#define ADXL362_REG_POWER_CTL 0x2D
87#define ADXL362_REG_SELF_TEST 0x2E
100static uint8_t a_adxl362_read(
adxl362_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
123static uint8_t a_adxl362_write(
adxl362_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
145static uint8_t a_adxl362_read_fifo(
adxl362_handle_t *handle, uint8_t *buf, uint16_t len)
147 if (handle->
spi_read(0x0D, buf, len) != 0)
184 handle->
debug_print(
"adxl362: read revision id failed.\n");
219 handle->
debug_print(
"adxl362: spi_init is null.\n");
225 handle->
debug_print(
"adxl362: spi_deinit is null.\n");
231 handle->
debug_print(
"adxl362: spi_read is null.\n");
237 handle->
debug_print(
"adxl362: spi_read_address16 is null.\n");
243 handle->
debug_print(
"adxl362: spi_write_address16 is null.\n");
249 handle->
debug_print(
"adxl362: delay_ms is null.\n");
255 handle->
debug_print(
"adxl362: receive_callback is null.\n");
262 handle->
debug_print(
"adxl362: spi init failed.\n");
313 handle->
debug_print(
"adxl362: soft reset failed.\n");
352 handle->
debug_print(
"adxl362: read power control failed.\n");
360 handle->
debug_print(
"adxl362: write power control failed.\n");
409 handle->
debug_print(
"adxl362: read filter failed.\n");
416 handle->
debug_print(
"adxl362: read data failed.\n");
420 raw[0] = (int8_t)buf[0];
421 raw[1] = (int8_t)buf[1];
422 raw[2] = (int8_t)buf[2];
423 range = (prev >> 6) & 0x3;
426 g[0] = (float)raw[0] * 16.0f / 1000.0f;
427 g[1] = (float)raw[1] * 16.0f / 1000.0f;
428 g[2] = (float)raw[2] * 16.0f / 1000.0f;
432 g[0] = (float)raw[0] * 16.0f / 500.0f;
433 g[1] = (float)raw[1] * 16.0f / 500.0f;
434 g[2] = (float)raw[2] * 16.0f / 500.0f;
438 g[0] = (float)raw[0] * 16.0f / 235.0f;
439 g[1] = (float)raw[1] * 16.0f / 235.0f;
440 g[2] = (float)raw[2] * 16.0f / 235.0f;
475 handle->
debug_print(
"adxl362: read temperature failed.\n");
479 *raw = (int16_t)((uint16_t)((((uint16_t)buf[1]) << 8) | buf[0]));
480 *temp = (float)(*raw) * 0.065f;
512 handle->
debug_print(
"adxl362: read status failed.\n");
548 handle->
debug_print(
"adxl362: read fifo entries failed.\n");
552 *counter = (uint16_t)(((uint16_t)buf[1]) << 8) | buf[0];
553 *counter = (*counter) & 0x200;
586 handle->
debug_print(
"adxl362: write soft reset failed.\n");
623 handle->
debug_print(
"adxl362: read fifo control failed.\n");
628 prev |= (enable << 2);
632 handle->
debug_print(
"adxl362: write fifo control failed.\n");
668 handle->
debug_print(
"adxl362: read fifo control failed.\n");
705 handle->
debug_print(
"adxl362: read fifo control failed.\n");
714 handle->
debug_print(
"adxl362: write fifo control failed.\n");
750 handle->
debug_print(
"adxl362: read fifo control failed.\n");
794 handle->
debug_print(
"adxl362: read fifo control failed.\n");
799 prev |= (((sample >> 8) & 0x01) << 3);
803 handle->
debug_print(
"adxl362: write fifo samples failed.\n");
808 prev = sample & 0xFF;
812 handle->
debug_print(
"adxl362: write fifo samples failed.\n");
849 handle->
debug_print(
"adxl362: read fifo control failed.\n");
856 handle->
debug_print(
"adxl362: read fifo samples failed.\n");
860 *sample = (uint16_t)((uint16_t)((prev >> 3) & 0x01) << 8) | prev2;
893 handle->
debug_print(
"adxl362: read int1 map failed.\n");
898 prev |= (level << 7);
902 handle->
debug_print(
"adxl362: write int1 map failed.\n");
938 handle->
debug_print(
"adxl362: read int1 map failed.\n");
976 handle->
debug_print(
"adxl362: read int1 map failed.\n");
981 prev |= (enable << map);
985 handle->
debug_print(
"adxl362: write int1 map failed.\n");
1022 handle->
debug_print(
"adxl362: read int1 map failed.\n");
1059 handle->
debug_print(
"adxl362: read int2 map failed.\n");
1064 prev |= (level << 7);
1068 handle->
debug_print(
"adxl362: write int2 map failed.\n");
1104 handle->
debug_print(
"adxl362: read int2 map failed.\n");
1142 handle->
debug_print(
"adxl362: read int2 map failed.\n");
1146 prev &= ~(1 << map);
1147 prev |= (enable << map);
1151 handle->
debug_print(
"adxl362: write int2 map failed.\n");
1188 handle->
debug_print(
"adxl362: read int2 map failed.\n");
1225 handle->
debug_print(
"adxl362: read filter control failed.\n");
1230 prev |= (range << 6);
1234 handle->
debug_print(
"adxl362: write filter control failed.\n");
1270 handle->
debug_print(
"adxl362: read filter control failed.\n");
1307 handle->
debug_print(
"adxl362: read filter control failed.\n");
1312 prev |= (bandwidth << 4);
1316 handle->
debug_print(
"adxl362: write filter control failed.\n");
1352 handle->
debug_print(
"adxl362: read filter control failed.\n");
1389 handle->
debug_print(
"adxl362: read filter control failed.\n");
1394 prev |= (enable << 3);
1398 handle->
debug_print(
"adxl362: write filter control failed.\n");
1434 handle->
debug_print(
"adxl362: read filter control failed.\n");
1471 handle->
debug_print(
"adxl362: read filter control failed.\n");
1480 handle->
debug_print(
"adxl362: write filter control failed.\n");
1516 handle->
debug_print(
"adxl362: read filter control failed.\n");
1553 handle->
debug_print(
"adxl362: read power control failed.\n");
1558 prev |= (enable << 6);
1562 handle->
debug_print(
"adxl362: write power control failed.\n");
1598 handle->
debug_print(
"adxl362: read power control failed.\n");
1635 handle->
debug_print(
"adxl362: read power control failed.\n");
1640 prev |= (mode << 4);
1644 handle->
debug_print(
"adxl362: write power control failed.\n");
1680 handle->
debug_print(
"adxl362: read power control failed.\n");
1717 handle->
debug_print(
"adxl362: read power control failed.\n");
1722 prev |= (enable << 3);
1726 handle->
debug_print(
"adxl362: write power control failed.\n");
1762 handle->
debug_print(
"adxl362: read power control failed.\n");
1799 handle->
debug_print(
"adxl362: read power control failed.\n");
1804 prev |= (enable << 2);
1808 handle->
debug_print(
"adxl362: write power control failed.\n");
1844 handle->
debug_print(
"adxl362: read power control failed.\n");
1881 handle->
debug_print(
"adxl362: read power control failed.\n");
1886 prev |= (mode << 0);
1890 handle->
debug_print(
"adxl362: write power control failed.\n");
1926 handle->
debug_print(
"adxl362: read power control failed.\n");
1963 handle->
debug_print(
"adxl362: read self test failed.\n");
1968 prev |= (enable << 0);
1972 handle->
debug_print(
"adxl362: write self test failed.\n");
2008 handle->
debug_print(
"adxl362: read self test failed.\n");
2042 if (threshold > 0x07FF)
2044 handle->
debug_print(
"adxl362: threshold is invalid.\n");
2049 buf[0] = threshold & 0xFF;
2050 buf[1] = (threshold >> 8) & 0xFF;
2054 handle->
debug_print(
"adxl362: write activity threshold failed.\n");
2090 handle->
debug_print(
"adxl362: read activity threshold failed.\n");
2094 *threshold = (uint16_t)((uint16_t)buf[1] << 8) | buf[0];
2095 *threshold &= 0x07FF;
2126 if (g - 0.0f < 1e-6)
2136 handle->
debug_print(
"adxl362: read filter failed.\n");
2140 range = (prev >> 6) & 0x3;
2143 *reg = (uint16_t)(g * 1000.0f);
2145 else if (range == 1)
2147 *reg = (uint16_t)(g * 500.0f);
2151 *reg = (uint16_t)(g * 235.0f);
2186 handle->
debug_print(
"adxl362: read filter failed.\n");
2190 range = (prev >> 6) & 0x3;
2193 *g = (float)((
float)reg / 1000.0f);
2195 else if (range == 1)
2197 *g = (float)((
float)reg / 500.0f);
2201 *g = (float)((
float)reg / 235.0f);
2236 handle->
debug_print(
"adxl362: write activity time failed.\n");
2272 handle->
debug_print(
"adxl362: read activity time failed.\n");
2307 if (ms - 0.0f < 1e-6)
2317 handle->
debug_print(
"adxl362: read filter failed.\n");
2321 range = (prev >> 0) & 0x7;
2324 *reg = (uint8_t)(ms / 1000.0f * 12.5f);
2326 else if (range == 1)
2328 *reg = (uint8_t)(ms / 1000.0f * 25.0f);
2330 else if (range == 2)
2332 *reg = (uint8_t)(ms / 1000.0f * 50.0f);
2334 else if (range == 3)
2336 *reg = (uint8_t)(ms / 1000.0f * 100.0f);
2338 else if (range == 4)
2340 *reg = (uint8_t)(ms / 1000.0f * 200.0f);
2344 *reg = (uint8_t)(ms / 1000.0f * 400.0f);
2379 handle->
debug_print(
"adxl362: read filter failed.\n");
2383 range = (prev >> 0) & 0x7;
2386 *ms = (float)((
float)reg / 12.5f * 1000.0f);
2388 else if (range == 1)
2390 *ms = (float)((
float)reg / 25.0f * 1000.0f);
2392 else if (range == 2)
2394 *ms = (float)((
float)reg / 50.0f * 1000.0f);
2396 else if (range == 3)
2398 *ms = (float)((
float)reg / 100.0f * 1000.0f);
2400 else if (range == 4)
2402 *ms = (float)((
float)reg / 200.0f * 1000.0f);
2406 *ms = (float)((
float)reg / 400.0f * 1000.0f);
2437 if (threshold > 0x07FF)
2439 handle->
debug_print(
"adxl362: threshold is invalid.\n");
2444 buf[0] = threshold & 0xFF;
2445 buf[1] = (threshold >> 8) & 0xFF;
2449 handle->
debug_print(
"adxl362: write inactivity threshold failed.\n");
2485 handle->
debug_print(
"adxl362: read inactivity threshold failed.\n");
2489 *threshold = (uint16_t)((uint16_t)buf[1] << 8) | buf[0];
2490 *threshold &= 0x07FF;
2521 if (g - 0.0f < 1e-6)
2531 handle->
debug_print(
"adxl362: read filter failed.\n");
2535 range = (prev >> 6) & 0x3;
2538 *reg = (uint16_t)(g * 1000.0f);
2540 else if (range == 1)
2542 *reg = (uint16_t)(g * 500.0f);
2546 *reg = (uint16_t)(g * 235.0f);
2581 handle->
debug_print(
"adxl362: read filter failed.\n");
2585 range = (prev >> 6) & 0x3;
2588 *g = (float)((
float)reg / 1000.0f);
2590 else if (range == 1)
2592 *g = (float)((
float)reg / 500.0f);
2596 *g = (float)((
float)reg / 235.0f);
2627 buf[0] = tim & 0xFF;
2628 buf[1] = (tim >> 8) & 0xFF;
2632 handle->
debug_print(
"adxl362: write inactivity time failed.\n");
2668 handle->
debug_print(
"adxl362: read inactivity time failed.\n");
2672 *tim = (uint16_t)((uint16_t)buf[1] << 8) | buf[0];
2703 if (ms - 0.0f < 1e-6)
2713 handle->
debug_print(
"adxl362: read filter failed.\n");
2717 range = (prev >> 0) & 0x7;
2720 *reg = (uint16_t)(ms / 1000.0f * 12.5f);
2722 else if (range == 1)
2724 *reg = (uint16_t)(ms / 1000.0f * 25.0f);
2726 else if (range == 2)
2728 *reg = (uint16_t)(ms / 1000.0f * 50.0f);
2730 else if (range == 3)
2732 *reg = (uint16_t)(ms / 1000.0f * 100.0f);
2734 else if (range == 4)
2736 *reg = (uint16_t)(ms / 1000.0f * 200.0f);
2740 *reg = (uint16_t)(ms / 1000.0f * 400.0f);
2775 handle->
debug_print(
"adxl362: read filter failed.\n");
2779 range = (prev >> 0) & 0x7;
2782 *ms = (float)((
float)reg / 12.5f * 1000.0f);
2784 else if (range == 1)
2786 *ms = (float)((
float)reg / 25.0f * 1000.0f);
2788 else if (range == 2)
2790 *ms = (float)((
float)reg / 50.0f * 1000.0f);
2792 else if (range == 3)
2794 *ms = (float)((
float)reg / 100.0f * 1000.0f);
2796 else if (range == 4)
2798 *ms = (float)((
float)reg / 200.0f * 1000.0f);
2802 *ms = (float)((
float)reg / 400.0f * 1000.0f);
2836 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
2841 prev |= (mode << 4);
2845 handle->
debug_print(
"adxl362: write action inaction control failed.\n");
2881 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
2918 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
2923 prev |= (trigger << 3);
2927 handle->
debug_print(
"adxl362: write action inaction control failed.\n");
2963 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3000 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3005 prev |= (trigger << 1);
3009 handle->
debug_print(
"adxl362: write action inaction control failed.\n");
3045 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3082 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3087 prev |= (enable << 2);
3091 handle->
debug_print(
"adxl362: write action inaction control failed.\n");
3127 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3164 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3169 prev |= (enable << 0);
3173 handle->
debug_print(
"adxl362: write action inaction control failed.\n");
3209 handle->
debug_print(
"adxl362: read action inaction control failed.\n");
3249 handle->
debug_print(
"adxl362: read x, y and z failed.\n");
3256 handle->
debug_print(
"adxl362: read filter failed.\n");
3260 range = (prev >> 6) & 0x3;
3263 raw[0] = (int16_t)((uint16_t)(buf[1]) << 8 | buf[0]);
3264 raw[1] = (int16_t)((uint16_t)(buf[3]) << 8 | buf[2]);
3265 raw[2] = (int16_t)((uint16_t)(buf[5]) << 8 | buf[4]);
3266 g[0] = (float)raw[0] / 1000.0f;
3267 g[1] = (float)raw[1] / 1000.0f;
3268 g[2] = (float)raw[2] / 1000.0f;
3270 else if (range == 1)
3272 raw[0] = (int16_t)((uint16_t)(buf[1]) << 8 | buf[0]);
3273 raw[1] = (int16_t)((uint16_t)(buf[3]) << 8 | buf[2]);
3274 raw[2] = (int16_t)((uint16_t)(buf[5]) << 8 | buf[4]);
3275 g[0] = (float)raw[0] / 500.0f;
3276 g[1] = (float)raw[1] / 500.0f;
3277 g[2] = (float)raw[2] / 500.0f;
3281 raw[0] = (int16_t)((uint16_t)(buf[1]) << 8 | buf[0]);
3282 raw[1] = (int16_t)((uint16_t)(buf[3]) << 8 | buf[2]);
3283 raw[2] = (int16_t)((uint16_t)(buf[5]) << 8 | buf[4]);
3284 g[0] = (float)raw[0] / 235.0f;
3285 g[1] = (float)raw[1] / 235.0f;
3286 g[2] = (float)raw[2] / 235.0f;
3326 handle->
debug_print(
"adxl362: read fifo entries failed.\n");
3330 len = (uint16_t)((uint16_t)buf[1] << 8) | buf[0];
3338 handle->
debug_print(
"adxl362: read fifo control failed.\n");
3342 len = len < (*frame_len) ? len : (*frame_len);
3343 if (((prev >> 2) & 0x01) != 0)
3345 len = (len / 4) * 4;
3349 len = (len / 3) * 3;
3351 res = a_adxl362_read_fifo(handle, handle->
buf, len * 2);
3354 handle->
debug_print(
"adxl362: read fifo failed.\n");
3362 handle->
debug_print(
"adxl362: read filter failed.\n");
3366 range = (prev >> 6) & 0x3;
3367 for (i = 0; i < len; i++)
3369 frame[i].
raw = (uint16_t)(handle->
buf[i * 2 + 1]) << 8 |
3371 type = (frame[i].
raw >> 14) & 0x03;
3372 frame[i].
raw &= 0x3FFF;
3373 if (((frame[i].raw >> 12) & 0x01) != 0)
3375 frame[i].
raw |= (int16_t)((uint16_t)0x3 << 14);
3380 frame[i].
data = (float)frame[i].raw * 0.065f;
3386 frame[i].
data = (float)frame[i].raw / 1000.0f;
3388 else if (range == 1)
3390 frame[i].
data = (float)frame[i].raw / 500.0f;
3394 frame[i].
data = (float)frame[i].raw / 235.0f;
3466 (void)a_adxl362_read_fifo(handle, handle->
buf, 512 * 2);
3519 return a_adxl362_write(handle, reg, buf, len);
3546 return a_adxl362_read(handle, reg, buf, len);
3572 return a_adxl362_read_fifo(handle, buf, len);
#define ADXL362_REG_SOFT_RESET
#define ADXL362_REG_TEMP_L
#define ADXL362_REG_FIFO_CONTROL
#define ADXL362_REG_PARTID
#define ADXL362_REG_THRESH_INACT_L
#define ADXL362_REG_SELF_TEST
#define ADXL362_REG_ACT_INACT_CTL
#define ADXL362_REG_REVID
#define ADXL362_REG_THRESH_ACT_L
#define ADXL362_REG_XDATA
#define ADXL362_REG_XDATA_L
#define SUPPLY_VOLTAGE_MAX
#define ADXL362_REG_FILTER_CTL
#define ADXL362_REG_DEVID_AD
chip register definition
#define ADXL362_REG_FIFO_SAMPLES
#define ADXL362_REG_POWER_CTL
#define ADXL362_REG_INTMAP2
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define ADXL362_REG_TIME_INACT_L
#define ADXL362_REG_STATUS
#define CHIP_NAME
chip register definition
#define ADXL362_REG_DEVID_MST
#define ADXL362_REG_FIFO_ENTRIES_L
#define ADXL362_REG_INTMAP1
#define ADXL362_REG_TIME_ACT
driver adxl362 header file
uint8_t adxl362_get_wake_up(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the chip wake up status
adxl362_detect_mode_t
adxl362 detect mode enumeration definition
uint8_t adxl362_get_interrupt_pin1_map(adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t *enable)
get the interrupt pin1 map
uint8_t adxl362_inactivity_threshold_convert_to_data(adxl362_handle_t *handle, uint16_t reg, float *g)
convert the register raw data to the inactivity threshold
adxl362_fifo_mode_t
adxl362 fifo mode enumeration definition
uint8_t adxl362_set_range(adxl362_handle_t *handle, adxl362_range_t range)
set the measurement range
uint8_t adxl362_get_self_test(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the self test status
uint8_t adxl362_read_8msb(adxl362_handle_t *handle, int8_t raw[3], float g[3])
read the data with eight most significant bits
uint8_t adxl362_set_interrupt_pin2_map(adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t enable)
set the interrupt pin2 map
uint8_t adxl362_get_noise_mode(adxl362_handle_t *handle, adxl362_noise_mode_t *mode)
get the noise mode
uint8_t adxl362_get_fifo_mode(adxl362_handle_t *handle, adxl362_fifo_mode_t *mode)
get the fifo mode
adxl362_bandwidth_t
adxl362 bandwidth enumeration definition
uint8_t adxl362_get_fifo_sample(adxl362_handle_t *handle, uint16_t *sample)
get the fifo sample
uint8_t adxl362_inactivity_time_convert_to_data(adxl362_handle_t *handle, uint16_t reg, float *ms)
convert the register raw data to the inactivity time
uint8_t adxl362_set_inactivity_detect_trigger(adxl362_handle_t *handle, adxl362_detect_trigger_t trigger)
set the inactivity detect trigger mode
uint8_t adxl362_set_fifo_sample(adxl362_handle_t *handle, uint16_t sample)
set the fifo sample
uint8_t adxl362_set_inactivity_time(adxl362_handle_t *handle, uint16_t tim)
set the inactivity time
struct adxl362_info_s adxl362_info_t
adxl362 information structure definition
uint8_t adxl362_set_fifo_mode(adxl362_handle_t *handle, adxl362_fifo_mode_t mode)
set the fifo mode
uint8_t adxl362_get_detect_mode(adxl362_handle_t *handle, adxl362_detect_mode_t *mode)
get the detect mode
uint8_t adxl362_info(adxl362_info_t *info)
get chip's information
adxl362_odr_t
adxl362 odr enumeration definition
uint8_t adxl362_set_self_test(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable the self test
adxl362_interrupt_map_t
adxl362 interrupt map enumeration definition
adxl362_mode_t
adxl362 mode enumeration definition
uint8_t adxl362_init(adxl362_handle_t *handle)
initialize the chip
uint8_t adxl362_set_detect_mode(adxl362_handle_t *handle, adxl362_detect_mode_t mode)
set the detect mode
struct adxl362_frame_s adxl362_frame_t
adxl362 frame structure definition
uint8_t adxl362_get_activity_time(adxl362_handle_t *handle, uint8_t *tim)
get the activity time
uint8_t adxl362_set_interrupt_pin2_active_level(adxl362_handle_t *handle, adxl362_interrupt_pin_level_t level)
set the interrupt pin2 active level
struct adxl362_handle_s adxl362_handle_t
adxl362 handle structure definition
uint8_t adxl362_get_interrupt_pin2_active_level(adxl362_handle_t *handle, adxl362_interrupt_pin_level_t *level)
get the interrupt pin2 active level
uint8_t adxl362_get_odr(adxl362_handle_t *handle, adxl362_odr_t *odr)
get the output data rate
uint8_t adxl362_set_wake_up(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable chip wake up
uint8_t adxl362_get_inactivity_threshold(adxl362_handle_t *handle, uint16_t *threshold)
get the inactivity threshold
uint8_t adxl362_set_inactivity_threshold(adxl362_handle_t *handle, uint16_t threshold)
set the inactivity threshold
uint8_t adxl362_get_bandwidth(adxl362_handle_t *handle, adxl362_bandwidth_t *bandwidth)
get the filter bandwidth
uint8_t adxl362_read(adxl362_handle_t *handle, int16_t raw[3], float g[3])
read the data
uint8_t adxl362_get_inactivity(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the inactivity status
uint8_t adxl362_set_interrupt_pin1_map(adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t enable)
set the interrupt pin1 map
uint8_t adxl362_get_inactivity_detect_trigger(adxl362_handle_t *handle, adxl362_detect_trigger_t *trigger)
get the inactivity detect trigger mode
uint8_t adxl362_set_noise_mode(adxl362_handle_t *handle, adxl362_noise_mode_t mode)
set the noise mode
uint8_t adxl362_set_activity_threshold(adxl362_handle_t *handle, uint16_t threshold)
set the activity threshold
uint8_t adxl362_activity_threshold_convert_to_register(adxl362_handle_t *handle, float g, uint16_t *reg)
convert the activity threshold to the register raw data
uint8_t adxl362_set_activity_time(adxl362_handle_t *handle, uint8_t tim)
set the activity time
uint8_t adxl362_get_mode(adxl362_handle_t *handle, adxl362_mode_t *mode)
get the chip mode
uint8_t adxl362_read_fifo(adxl362_handle_t *handle, adxl362_frame_t *frame, uint16_t *frame_len)
read data from the fifo
uint8_t adxl362_get_auto_sleep(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the auto sleep status
adxl362_noise_mode_t
adxl362 noise mode enumeration definition
uint8_t adxl362_set_interrupt_pin1_active_level(adxl362_handle_t *handle, adxl362_interrupt_pin_level_t level)
set the interrupt pin1 active level
uint8_t adxl362_get_fifo_counter(adxl362_handle_t *handle, uint16_t *counter)
get the fifo counter
uint8_t adxl362_get_fifo_temperature(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the fifo temperature status
uint8_t adxl362_get_activity_detect_trigger(adxl362_handle_t *handle, adxl362_detect_trigger_t *trigger)
get the activity detect trigger mode
uint8_t adxl362_get_revision(adxl362_handle_t *handle, uint8_t *id)
get the chip revision
uint8_t adxl362_inactivity_time_convert_to_register(adxl362_handle_t *handle, float ms, uint16_t *reg)
convert the inactivity time to the register raw data
uint8_t adxl362_set_fifo_temperature(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable saving temperature data to fifo
uint8_t adxl362_get_inactivity_time(adxl362_handle_t *handle, uint16_t *tim)
get the inactivity time
adxl362_bool_t
adxl362 bool enumeration definition
uint8_t adxl362_set_activity_detect_trigger(adxl362_handle_t *handle, adxl362_detect_trigger_t trigger)
set the activity detect trigger mode
adxl362_range_t
adxl362 range enumeration definition
uint8_t adxl362_set_interrupt_pin1_as_external_clock(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable interrupt pin1 as the external clock
uint8_t adxl362_irq_handler(adxl362_handle_t *handle)
irq handler
adxl362_detect_trigger_t
adxl362 detect trigger enumeration definition
uint8_t adxl362_set_mode(adxl362_handle_t *handle, adxl362_mode_t mode)
set the chip mode
uint8_t adxl362_get_interrupt_pin1_active_level(adxl362_handle_t *handle, adxl362_interrupt_pin_level_t *level)
get the interrupt pin1 active level
uint8_t adxl362_get_activity(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the activity status
uint8_t adxl362_set_inactivity(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable inactivity
adxl362_interrupt_pin_level_t
adxl362 interrupt pin level enumeration definition
uint8_t adxl362_activity_time_convert_to_register(adxl362_handle_t *handle, float ms, uint8_t *reg)
convert the activity time to the register raw data
adxl362_frame_type_t
adxl362 frame type enumeration definition
uint8_t adxl362_get_interrupt_pin1_as_external_clock(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the interrupt pin1 as the external clock status
uint8_t adxl362_inactivity_threshold_convert_to_register(adxl362_handle_t *handle, float g, uint16_t *reg)
convert the inactivity threshold to the register raw data
uint8_t adxl362_get_interrupt_pin2_as_external_sampling_trigger(adxl362_handle_t *handle, adxl362_bool_t *enable)
get the interrupt pin2 as the external sampling trigger status
uint8_t adxl362_set_interrupt_pin2_as_external_sampling_trigger(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable interrupt pin2 as the external sampling trigger
uint8_t adxl362_get_status(adxl362_handle_t *handle, uint8_t *status)
get the chip status
uint8_t adxl362_set_activity(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable activity
uint8_t adxl362_soft_reset(adxl362_handle_t *handle)
soft reset
uint8_t adxl362_set_auto_sleep(adxl362_handle_t *handle, adxl362_bool_t enable)
enable or disable auto sleep
uint8_t adxl362_get_range(adxl362_handle_t *handle, adxl362_range_t *range)
get the measurement range
uint8_t adxl362_get_activity_threshold(adxl362_handle_t *handle, uint16_t *threshold)
get the activity threshold
uint8_t adxl362_get_interrupt_pin2_map(adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t *enable)
get the interrupt pin2 map
uint8_t adxl362_read_temperature(adxl362_handle_t *handle, int16_t *raw, float *temp)
read the temperature
uint8_t adxl362_activity_threshold_convert_to_data(adxl362_handle_t *handle, uint16_t reg, float *g)
convert the register raw data to the activity threshold
uint8_t adxl362_set_bandwidth(adxl362_handle_t *handle, adxl362_bandwidth_t bandwidth)
set the filter bandwidth
uint8_t adxl362_deinit(adxl362_handle_t *handle)
close the chip
uint8_t adxl362_activity_time_convert_to_data(adxl362_handle_t *handle, uint8_t reg, float *ms)
convert the register raw data to the activity time
uint8_t adxl362_set_odr(adxl362_handle_t *handle, adxl362_odr_t odr)
set the output data rate
@ ADXL362_STATUS_DATA_READY
@ ADXL362_STATUS_FIFO_OVERRUN
@ ADXL362_STATUS_FIFO_READY
@ ADXL362_STATUS_ERR_USER_REGS
@ ADXL362_STATUS_FIFO_WATERMARK
@ ADXL362_FRAME_TYPE_TEMP
uint8_t adxl362_get_reg(adxl362_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t adxl362_get_fifo(adxl362_handle_t *handle, uint8_t *buf, uint16_t len)
read from fifo
uint8_t adxl362_set_reg(adxl362_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
adxl362_frame_type_t type
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
void(* receive_callback)(uint8_t type)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_write_address16)(uint16_t addr, uint8_t *buf, uint16_t len)
uint8_t(* spi_read_address16)(uint16_t addr, uint8_t *buf, uint16_t len)
uint8_t(* spi_deinit)(void)
uint8_t(* spi_read)(uint8_t addr, uint8_t *buf, uint16_t len)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v