Bridle API 4.1.99
A Zephyr based application framework
Loading...
Searching...
No Matches
stk8ba58_reg.h
Go to the documentation of this file.
1/*
2 * Sensortek Technology STK8BA58 3-axis accelerometer driver
3 *
4 * Copyright (c) 2025 TiaC Systems
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 */
8
14#ifndef STK8BA58_REGS_H
15#define STK8BA58_REGS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdint.h>
22#include <stddef.h>
23#include <math.h>
24
25#include <zephyr/drivers/i2c.h>
26
51#ifndef STK8BA58_BYTE_ORDER
52
53#define STK8BA58_LITTLE_ENDIAN 1234
54#define STK8BA58_BIG_ENDIAN 4321
55
56#if defined(CONFIG_LITTLE_ENDIAN) && (CONFIG_LITTLE_ENDIAN)
57#define STK8BA58_BYTE_ORDER STK8BA58_LITTLE_ENDIAN
58
59#elif defined(CONFIG_BIG_ENDIAN) && (CONFIG_BIG_ENDIAN)
60#define STK8BA58_BYTE_ORDER STK8BA58_BIG_ENDIAN
61
62#else
63#error unsupported chosen endianness by architecture
64#endif
65
66#endif /* STK8BA58_BYTE_ORDER */
67
83#define STK8BA58_ID 0x87U
84
86#define STK8BA58_XOUT1_DFL 0x00U
87
89#define STK8BA58_XOUT2_DFL 0x00U
90
92#define STK8BA58_YOUT1_DFL 0x00U
93
95#define STK8BA58_YOUT2_DFL 0x00U
96
98#define STK8BA58_ZOUT1_DFL 0x00U
99
101#define STK8BA58_ZOUT2_DFL 0x00U
102
104#define STK8BA58_INTSTS1_DFL 0x00U
105
107#define STK8BA58_INTSTS2_DFL 0x00U
108
110#define STK8BA58_EVENTINFO1_DFL 0x00U
111
113#define STK8BA58_RANGESEL_DFL 0x00U
114
116#define STK8BA58_BWSEL_DFL 0x1FU
117
119#define STK8BA58_POWMODE_DFL 0x00U
120
122#define STK8BA58_DATASETUP_DFL 0x00U
123
125#define STK8BA58_SWRST_DFL 0x00U
126
128#define STK8BA58_RST 0xB6U
129
131#define STK8BA58_INTEN1_DFL 0x00U
132
134#define STK8BA58_INTEN2_DFL 0x00U
135
137#define STK8BA58_INTMAP1_DFL 0x00U
138
140#define STK8BA58_INTMAP2_DFL 0x00U
141
143#define STK8BA58_INTCFG1_DFL 0x01U
144
146#define STK8BA58_INTCFG2_DFL 0x00U
147
149#define STK8BA58_SLOPEDLY_DFL 0x00U
150
152#define STK8BA58_SLOPETHD_DFL 0x14U
153
155#define STK8BA58_SIGMOT1_DFL 0x96U
156
158#define STK8BA58_SIGMOT2_DFL 0x02U
159
161#define STK8BA58_SIGMOT3_DFL 0x32U
162
164#define STK8BA58_INTFCFG_DFL 0x00U
165
167#define STK8BA58_OFSTCOMP1_DFL 0x00U
168
170#define STK8BA58_OFSTX_DFL 0x00U
171
173#define STK8BA58_OFSTY_DFL 0x00U
174
176#define STK8BA58_OFSTZ_DFL 0x00U
177
184#define STK8BA58_CHIP_ID 0x00U
185
187#define STK8BA58_XOUT1 0x02U
188
190#define STK8BA58_YOUT1 0x04U
191
193#define STK8BA58_ZOUT1 0x06U
194
196typedef struct {
197#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
198 uint8_t new : 1;
199 uint8_t not_used_01 : 3;
200 uint8_t out : 4;
201#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
202 uint8_t out : 4;
203 uint8_t not_used_01 : 3;
204 uint8_t new : 1;
205#endif /* STK8BA58_BYTE_ORDER */
207
209#define STK8BA58_XOUT2 0x03U
210
212#define STK8BA58_YOUT2 0x05U
213
215#define STK8BA58_ZOUT2 0x07U
216
218typedef struct {
219#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
220 uint8_t out : 8;
221#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
222 uint8_t out : 8;
223#endif /* STK8BA58_BYTE_ORDER */
225
227#define STK8BA58_INTSTS1 0x09U
228
230typedef struct {
231#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
232 uint8_t sig_mot_sts : 1;
233 uint8_t not_used_01 : 1;
234 uint8_t any_mot_sts : 1;
235 uint8_t not_used_02 : 5;
236#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
237 uint8_t not_used_02 : 5;
238 uint8_t any_mot_sts : 1;
239 uint8_t not_used_01 : 1;
240 uint8_t sig_mot_sts : 1;
241#endif /* STK8BA58_BYTE_ORDER */
243
245#define STK8BA58_INTSTS2 0x0AU
246
248typedef struct {
249#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
250 uint8_t not_used_01 : 7;
251 uint8_t data_sts : 1;
252#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
253 uint8_t data_sts : 1;
254 uint8_t not_used_01 : 7;
255#endif /* STK8BA58_BYTE_ORDER */
257
259#define STK8BA58_EVENTINFO1 0x0BU
260
262typedef struct {
263#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
264 uint8_t slp_1st_x : 1;
265 uint8_t slp_1st_y : 1;
266 uint8_t slp_1st_z : 1;
267 uint8_t not_used_01 : 1;
268 uint8_t slpsign_x : 1;
269 uint8_t slpsign_y : 1;
270 uint8_t slpsign_z : 1;
271 uint8_t not_used_02 : 1;
272#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
273 uint8_t not_used_02 : 1;
274 uint8_t slpsign_z : 1;
275 uint8_t slpsign_y : 1;
276 uint8_t slpsign_x : 1;
277 uint8_t not_used_01 : 1;
278 uint8_t slp_1st_z : 1;
279 uint8_t slp_1st_y : 1;
280 uint8_t slp_1st_x : 1;
281#endif /* STK8BA58_BYTE_ORDER */
283
285#define STK8BA58_RANGESEL 0x0FU
286
288typedef struct {
289#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
290 uint8_t range : 4;
291 uint8_t not_used_01 : 4;
292#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
293 uint8_t not_used_01 : 4;
294 uint8_t range : 4;
295#endif /* STK8BA58_BYTE_ORDER */
297
299#define STK8BA58_BWSEL 0x10U
300
302typedef struct {
303#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
304 uint8_t bw : 5;
305 uint8_t not_used_01 : 3;
306#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
307 uint8_t not_used_01 : 3;
308 uint8_t bw : 5;
309#endif /* STK8BA58_BYTE_ORDER */
311
313#define STK8BA58_POWMODE 0x11U
314
316typedef struct {
317#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
318 uint8_t not_used_01 : 1;
319 uint8_t sleep_dur : 4;
320 uint8_t not_used_02 : 1;
321 uint8_t lowpower : 1;
322 uint8_t suspend : 1;
323#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
324 uint8_t suspend : 1;
325 uint8_t lowpower : 1;
326 uint8_t not_used_02 : 1;
327 uint8_t sleep_dur : 4;
328 uint8_t not_used_01 : 1;
329#endif /* STK8BA58_BYTE_ORDER */
331
333#define STK8BA58_DATASETUP 0x13U
334
336typedef struct {
337#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
338 uint8_t not_used_01 : 6;
339 uint8_t protect_dis : 1;
340 uint8_t data_sel : 1;
341#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
342 uint8_t data_sel : 1;
343 uint8_t protect_dis : 1;
344 uint8_t not_used_01 : 6;
345#endif /* STK8BA58_BYTE_ORDER */
347
349#define STK8BA58_SWRST 0x14U
350
352#define STK8BA58_INTEN1 0x16U
353
355typedef struct {
356#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
357 uint8_t slp_en_x : 1;
358 uint8_t slp_en_y : 1;
359 uint8_t slp_en_z : 1;
360 uint8_t not_used_01 : 5;
361#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
362 uint8_t not_used_01 : 5;
363 uint8_t slp_en_z : 1;
364 uint8_t slp_en_y : 1;
365 uint8_t slp_en_x : 1;
366#endif /* STK8BA58_BYTE_ORDER */
368
370#define STK8BA58_INTEN2 0x17U
371
373typedef struct {
374#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
375 uint8_t not_used_01 : 4;
376 uint8_t data_en : 1;
377 uint8_t not_used_02 : 3;
378#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
379 uint8_t not_used_02 : 3;
380 uint8_t data_en : 1;
381 uint8_t not_used_01 : 4;
382#endif /* STK8BA58_BYTE_ORDER */
384
386#define STK8BA58_INTMAP1 0x19U
387
389typedef struct {
390#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
391 uint8_t sigmot2int1 : 1;
392 uint8_t not_used_01 : 1;
393 uint8_t anymot2int1 : 1;
394 uint8_t not_used_02 : 5;
395#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
396 uint8_t not_used_02 : 5;
397 uint8_t anymot2int1 : 1;
398 uint8_t not_used_01 : 1;
399 uint8_t sigmot2int1 : 1;
400#endif /* STK8BA58_BYTE_ORDER */
402
404#define STK8BA58_INTMAP2 0x1AU
405
407typedef struct {
408#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
409 uint8_t data2int1 : 1;
410 uint8_t not_used_01 : 7;
411#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
412 uint8_t not_used_01 : 7;
413 uint8_t data2int1 : 1;
414#endif /* STK8BA58_BYTE_ORDER */
416
418#define STK8BA58_INTCFG1 0x20U
419
421typedef struct {
422#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
423 uint8_t int1_lv : 1;
424 uint8_t int1_od : 1;
425 uint8_t not_used_01 : 6;
426#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
427 uint8_t not_used_01 : 6;
428 uint8_t int1_od : 1;
429 uint8_t int1_lv : 1;
430#endif /* STK8BA58_BYTE_ORDER */
432
434#define STK8BA58_INTCFG2 0x21U
435
437typedef struct {
438#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
439 uint8_t int_latch : 4;
440 uint8_t not_used_01 : 3;
441 uint8_t int_rst : 1;
442#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
443 uint8_t int_rst : 1;
444 uint8_t not_used_01 : 3;
445 uint8_t int_latch : 4;
446#endif /* STK8BA58_BYTE_ORDER */
448
450#define STK8BA58_SLOPEDLY 0x27U
451
453typedef struct {
454#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
455 uint8_t slp_dur : 2;
456 uint8_t not_used_01 : 6;
457#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
458 uint8_t not_used_01 : 6;
459 uint8_t slp_dur : 2;
460#endif /* STK8BA58_BYTE_ORDER */
462
464#define STK8BA58_SLOPETHD 0x28U
465
467#define STK8BA58_SIGMOT1 0x29U
468
470typedef struct {
471#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
472 uint8_t skip_time : 8;
473#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
474 uint8_t skip_time : 8;
475#endif /* STK8BA58_BYTE_ORDER */
477
479#define STK8BA58_SIGMOT2 0x2AU
480
482typedef struct {
483#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
484 uint8_t skip_time : 1;
485 uint8_t sig_mot_en : 1;
486 uint8_t any_mot_en : 1;
487 uint8_t not_used_01 : 5;
488#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
489 uint8_t not_used_01 : 5;
490 uint8_t any_mot_en : 1;
491 uint8_t sig_mot_en : 1;
492 uint8_t skip_time : 1;
493#endif /* STK8BA58_BYTE_ORDER */
495
497#define STK8BA58_SIGMOT3 0x2BU
498
500typedef struct {
501#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
502 uint8_t proof_time : 7;
503 uint8_t not_used_01 : 1;
504#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
505 uint8_t not_used_01 : 1;
506 uint8_t proof_time : 7;
507#endif /* STK8BA58_BYTE_ORDER */
509
511#define STK8BA58_INTFCFG 0x34U
512
514typedef struct {
515#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
516 uint8_t not_used_01 : 1;
517 uint8_t i2c_wdt_sel : 1;
518 uint8_t i2c_wdt_en : 1;
519 uint8_t not_used_02 : 5;
520#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
521 uint8_t not_used_02 : 5;
522 uint8_t i2c_wdt_en : 1;
523 uint8_t i2c_wdt_sel : 1;
524 uint8_t not_used_01 : 1;
525#endif /* STK8BA58_BYTE_ORDER */
527
529#define STK8BA58_OFSTCOMP1 0x36U
530
532typedef struct {
533#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
534 uint8_t not_used_01 : 7;
535 uint8_t ofst_rst : 1;
536#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
537 uint8_t ofst_rst : 1;
538 uint8_t not_used_01 : 7;
539#endif /* STK8BA58_BYTE_ORDER */
541
543#define STK8BA58_OFSTX 0x38U
544
546#define STK8BA58_OFSTY 0x39U
547
549#define STK8BA58_OFSTZ 0x3AU
550
552typedef struct {
553#if STK8BA58_BYTE_ORDER == STK8BA58_LITTLE_ENDIAN
554 uint8_t comp : 8;
555#elif STK8BA58_BYTE_ORDER == STK8BA58_BIG_ENDIAN
556 uint8_t comp : 8;
557#endif /* STK8BA58_BYTE_ORDER */
559
560/*
561 * These are the basic platform dependent I/O routines to read
562 * and write device registers connected on a standard I2C bus.
563 */
564
565int32_t stk8ba58_read_reg(const struct i2c_dt_spec *i2c, uint8_t reg,
566 uint8_t *data, uint16_t len);
567int32_t stk8ba58_write_reg(const struct i2c_dt_spec *i2c, uint8_t reg,
568 uint8_t *data, uint16_t len);
569
574#define STK8BA58_I2C_WRITE_BUFFER_SIZE (16U)
575
576float_t stk8ba58_from_fs2g_to_mg(int16_t lsb);
577float_t stk8ba58_from_fs4g_to_mg(int16_t lsb);
578float_t stk8ba58_from_fs8g_to_mg(int16_t lsb);
579
586
587int32_t stk8ba58_all_sources_get(const struct i2c_dt_spec *i2c,
589
591typedef enum {
592 STK8BA58_2g = 0b0011,
593 STK8BA58_4g = 0b0101,
594 STK8BA58_8g = 0b1000,
596
597int32_t stk8ba58_xl_range_set(const struct i2c_dt_spec *i2c,
598 stk8ba58_range_t val);
599int32_t stk8ba58_xl_range_get(const struct i2c_dt_spec *i2c,
600 stk8ba58_range_t *val);
601
614
619
620int32_t stk8ba58_xl_bandwidth_set(const struct i2c_dt_spec *i2c,
622int32_t stk8ba58_xl_bandwidth_get(const struct i2c_dt_spec *i2c,
623 stk8ba58_bw_t *val, stk8ba58_ds_t *sel);
624
639
646
647int32_t stk8ba58_xl_power_mode_set(const struct i2c_dt_spec *i2c,
649int32_t stk8ba58_xl_power_mode_get(const struct i2c_dt_spec *i2c,
651
652int32_t stk8ba58_acceleration_raw_get(const struct i2c_dt_spec *i2c,
653 int16_t *buff);
654
655int32_t stk8ba58_device_id_get(const struct i2c_dt_spec *i2c, uint8_t *buff);
656
657int32_t stk8ba58_reset_set(const struct i2c_dt_spec *i2c, uint8_t val);
658
664
665int32_t stk8ba58_pin_int1_mode_set(const struct i2c_dt_spec *i2c,
666 stk8ba58_pp_od_t val);
667int32_t stk8ba58_pin_int1_mode_get(const struct i2c_dt_spec *i2c,
668 stk8ba58_pp_od_t *val);
669
675
676int32_t stk8ba58_pin_int1_polarity_set(const struct i2c_dt_spec *i2c,
678int32_t stk8ba58_pin_int1_polarity_get(const struct i2c_dt_spec *i2c,
680
700
701int32_t stk8ba58_int_notification_set(const struct i2c_dt_spec *i2c,
703int32_t stk8ba58_int_notification_get(const struct i2c_dt_spec *i2c,
705
707typedef struct {
708 uint8_t sigmot2int1 : 1;
709 uint8_t anymot2int1 : 1;
710 uint8_t data2int1 : 1;
712
713int32_t stk8ba58_pin_int1_route_set(const struct i2c_dt_spec *i2c,
715int32_t stk8ba58_pin_int1_route_get(const struct i2c_dt_spec *i2c,
717
719typedef struct {
720 uint8_t slp_en_x : 1;
721 uint8_t slp_en_y : 1;
722 uint8_t slp_en_z : 1;
723 uint8_t data_en : 1;
725
726int32_t stk8ba58_int_enable_set(const struct i2c_dt_spec *i2c,
728int32_t stk8ba58_int_enable_get(const struct i2c_dt_spec *i2c,
730
736#ifdef __cplusplus
737}
738#endif
739
740#endif /* STK8BA58_REGS_H */
stk8ba58_pp_od_t
Values for INT1 pin output type.
Definition stk8ba58_reg.h:660
stk8ba58_hl_active_t
Values for INT1 pin output active level.
Definition stk8ba58_reg.h:671
int32_t stk8ba58_int_notification_get(const struct i2c_dt_spec *i2c, stk8ba58_intlatch_t *val)
Latched/pulsed interrupt.
Definition stk8ba58_reg.c:737
stk8ba58_pm_t
Values for output data filter and protection function.
Definition stk8ba58_reg.h:641
float_t stk8ba58_from_fs8g_to_mg(int16_t lsb)
Definition stk8ba58_reg.c:117
int32_t stk8ba58_acceleration_raw_get(const struct i2c_dt_spec *i2c, int16_t *buff)
Linear acceleration output register.
Definition stk8ba58_reg.c:491
int32_t stk8ba58_pin_int1_mode_get(const struct i2c_dt_spec *i2c, stk8ba58_pp_od_t *val)
Push-pull/open-drain selection on interrupt pad.
Definition stk8ba58_reg.c:626
int32_t stk8ba58_pin_int1_polarity_get(const struct i2c_dt_spec *i2c, stk8ba58_hl_active_t *val)
Polarity active-high/-low selection on interrupt pad.
Definition stk8ba58_reg.c:681
stk8ba58_intlatch_t
Values for INT1 pin mode and latched hold-time.
Definition stk8ba58_reg.h:682
int32_t stk8ba58_int_enable_set(const struct i2c_dt_spec *i2c, stk8ba58_int_enable_t val)
Enable the source that need to trigger interrupt.
Definition stk8ba58_reg.c:891
int32_t stk8ba58_xl_power_mode_get(const struct i2c_dt_spec *i2c, stk8ba58_sleepdur_t *val, stk8ba58_pm_t *sel)
Accelerometer bandwidth selection.
Definition stk8ba58_reg.c:394
int32_t stk8ba58_read_reg(const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t *data, uint16_t len)
Read generic device register.
Definition stk8ba58_reg.c:51
float_t stk8ba58_from_fs4g_to_mg(int16_t lsb)
Definition stk8ba58_reg.c:112
int32_t stk8ba58_pin_int1_route_get(const struct i2c_dt_spec *i2c, stk8ba58_pin_int1_route_t *val)
Select the signal that need to route on int1 pad.
Definition stk8ba58_reg.c:862
int32_t stk8ba58_pin_int1_mode_set(const struct i2c_dt_spec *i2c, stk8ba58_pp_od_t val)
Push-pull/open-drain selection on interrupt pad.
Definition stk8ba58_reg.c:601
int32_t stk8ba58_write_reg(const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t *data, uint16_t len)
Write generic device register.
Definition stk8ba58_reg.c:75
stk8ba58_ds_t
Definition stk8ba58_reg.h:615
int32_t stk8ba58_xl_range_set(const struct i2c_dt_spec *i2c, stk8ba58_range_t val)
Accelerometer range selection.
Definition stk8ba58_reg.c:172
int32_t stk8ba58_device_id_get(const struct i2c_dt_spec *i2c, uint8_t *buff)
DeviceChipID.
Definition stk8ba58_reg.c:542
int32_t stk8ba58_xl_power_mode_set(const struct i2c_dt_spec *i2c, stk8ba58_sleepdur_t val, stk8ba58_pm_t sel)
Accelerometer power mode selection.
Definition stk8ba58_reg.c:348
int32_t stk8ba58_int_enable_get(const struct i2c_dt_spec *i2c, stk8ba58_int_enable_t *val)
Enable the source that need to trigger interrupt.
Definition stk8ba58_reg.c:931
int32_t stk8ba58_all_sources_get(const struct i2c_dt_spec *i2c, stk8ba58_all_sources_t *val)
Read all the interrupt/status flag of the device.
Definition stk8ba58_reg.c:143
stk8ba58_sleepdur_t
Values for power mode selection and the sleep time duration setting.
Definition stk8ba58_reg.h:626
int32_t stk8ba58_xl_bandwidth_set(const struct i2c_dt_spec *i2c, stk8ba58_bw_t val, stk8ba58_ds_t sel)
Accelerometer bandwidth selection.
Definition stk8ba58_reg.c:234
float_t stk8ba58_from_fs2g_to_mg(int16_t lsb)
Definition stk8ba58_reg.c:107
int32_t stk8ba58_pin_int1_route_set(const struct i2c_dt_spec *i2c, stk8ba58_pin_int1_route_t val)
Select the signal that need to route on int1 pad.
Definition stk8ba58_reg.c:823
stk8ba58_bw_t
Values for output data bandwidth selection.
Definition stk8ba58_reg.h:603
stk8ba58_range_t
Values for acceleration sensing range.
Definition stk8ba58_reg.h:591
int32_t stk8ba58_pin_int1_polarity_set(const struct i2c_dt_spec *i2c, stk8ba58_hl_active_t val)
Polarity active-high/-low selection on interrupt pad.
Definition stk8ba58_reg.c:656
int32_t stk8ba58_xl_range_get(const struct i2c_dt_spec *i2c, stk8ba58_range_t *val)
Accelerometer range selection.
Definition stk8ba58_reg.c:198
int32_t stk8ba58_int_notification_set(const struct i2c_dt_spec *i2c, stk8ba58_intlatch_t val)
Latched/pulsed interrupt.
Definition stk8ba58_reg.c:711
int32_t stk8ba58_xl_bandwidth_get(const struct i2c_dt_spec *i2c, stk8ba58_bw_t *val, stk8ba58_ds_t *sel)
Accelerometer bandwidth selection.
Definition stk8ba58_reg.c:272
int32_t stk8ba58_reset_set(const struct i2c_dt_spec *i2c, uint8_t val)
Software reset.
Definition stk8ba58_reg.c:560
@ STK8BA58_OPEN_DRAIN
Definition stk8ba58_reg.h:662
@ STK8BA58_PUSH_PULL
Definition stk8ba58_reg.h:661
@ STK8BA58_ACTIVE_LOW
Definition stk8ba58_reg.h:672
@ STK8BA58_ACTIVE_HIGH
Definition stk8ba58_reg.h:673
@ STK8BA58_XL_PM_SUSPEND
Definition stk8ba58_reg.h:644
@ STK8BA58_XL_PM_NORMAL
Definition stk8ba58_reg.h:642
@ STK8BA58_XL_PM_LOWPOWER
Definition stk8ba58_reg.h:643
@ STK8BA58_INT_500ms
Definition stk8ba58_reg.h:685
@ STK8BA58_INT_PULSED
Definition stk8ba58_reg.h:683
@ STK8BA58_INT_1ms
Definition stk8ba58_reg.h:694
@ STK8BA58_INT_LATCHEDALT
Definition stk8ba58_reg.h:690
@ STK8BA58_INT_PULSEDALT
Definition stk8ba58_reg.h:691
@ STK8BA58_INT_4000ms
Definition stk8ba58_reg.h:688
@ STK8BA58_INT_LATCHED
Definition stk8ba58_reg.h:698
@ STK8BA58_INT_2000ms
Definition stk8ba58_reg.h:687
@ STK8BA58_INT_250ms
Definition stk8ba58_reg.h:684
@ STK8BA58_INT_1000ms
Definition stk8ba58_reg.h:686
@ STK8BA58_INT_50ms
Definition stk8ba58_reg.h:697
@ STK8BA58_INT_0ms250
Definition stk8ba58_reg.h:692
@ STK8BA58_INT_12ms5
Definition stk8ba58_reg.h:695
@ STK8BA58_INT_8000ms
Definition stk8ba58_reg.h:689
@ STK8BA58_INT_25ms
Definition stk8ba58_reg.h:696
@ STK8BA58_INT_0ms500
Definition stk8ba58_reg.h:693
@ STK8BA58_XL_DS_UNFILTERED
Definition stk8ba58_reg.h:617
@ STK8BA58_XL_DS_FILTERED
Definition stk8ba58_reg.h:616
@ STK8BA58_XL_LP_4ms
Definition stk8ba58_reg.h:630
@ STK8BA58_XL_LP_10ms
Definition stk8ba58_reg.h:632
@ STK8BA58_XL_LP_500ms
Definition stk8ba58_reg.h:636
@ STK8BA58_XL_LP_1000ms
Definition stk8ba58_reg.h:637
@ STK8BA58_XL_LP_50ms
Definition stk8ba58_reg.h:634
@ STK8BA58_XL_LP_2ms
Definition stk8ba58_reg.h:629
@ STK8BA58_XL_LP_100ms
Definition stk8ba58_reg.h:635
@ STK8BA58_XL_LP_6ms
Definition stk8ba58_reg.h:631
@ STK8BA58_XL_LP_1ms
Definition stk8ba58_reg.h:628
@ STK8BA58_XL_LP_25ms
Definition stk8ba58_reg.h:633
@ STK8BA58_XL_LP_0ms5
Definition stk8ba58_reg.h:627
@ STK8BA58_XL_BW_62Hz5
Definition stk8ba58_reg.h:607
@ STK8BA58_XL_BW_15Hz63
Definition stk8ba58_reg.h:605
@ STK8BA58_XL_BW_PWRUP
Definition stk8ba58_reg.h:612
@ STK8BA58_XL_BW_1000Hz
Definition stk8ba58_reg.h:611
@ STK8BA58_XL_BW_500Hz
Definition stk8ba58_reg.h:610
@ STK8BA58_XL_BW_250Hz
Definition stk8ba58_reg.h:609
@ STK8BA58_XL_BW_7Hz81
Definition stk8ba58_reg.h:604
@ STK8BA58_XL_BW_125Hz
Definition stk8ba58_reg.h:608
@ STK8BA58_XL_BW_31Hz25
Definition stk8ba58_reg.h:606
@ STK8BA58_2g
Definition stk8ba58_reg.h:592
@ STK8BA58_8g
Definition stk8ba58_reg.h:594
@ STK8BA58_4g
Definition stk8ba58_reg.h:593
Data for motion detection and data interrupts status.
Definition stk8ba58_reg.h:581
stk8ba58_intsts1_t intsts1
Definition stk8ba58_reg.h:582
stk8ba58_intsts2_t intsts2
Definition stk8ba58_reg.h:583
stk8ba58_eventinfo1_t eventinfo1
Definition stk8ba58_reg.h:584
Data for output data bandwidth selection.
Definition stk8ba58_reg.h:302
uint8_t not_used_01
Definition stk8ba58_reg.h:305
uint8_t bw
Definition stk8ba58_reg.h:304
Data for output data filter and protection function.
Definition stk8ba58_reg.h:336
uint8_t protect_dis
Definition stk8ba58_reg.h:339
uint8_t not_used_01
Definition stk8ba58_reg.h:338
uint8_t data_sel
Definition stk8ba58_reg.h:340
Data for any-motion (slope) detection information.
Definition stk8ba58_reg.h:262
uint8_t slp_1st_z
Definition stk8ba58_reg.h:266
uint8_t slpsign_y
Definition stk8ba58_reg.h:269
uint8_t slp_1st_x
Definition stk8ba58_reg.h:264
uint8_t slpsign_z
Definition stk8ba58_reg.h:270
uint8_t not_used_02
Definition stk8ba58_reg.h:271
uint8_t slpsign_x
Definition stk8ba58_reg.h:268
uint8_t slp_1st_y
Definition stk8ba58_reg.h:265
uint8_t not_used_01
Definition stk8ba58_reg.h:267
Data for motion detection and data interrupts enable.
Definition stk8ba58_reg.h:719
uint8_t slp_en_y
Definition stk8ba58_reg.h:721
uint8_t slp_en_z
Definition stk8ba58_reg.h:722
uint8_t data_en
Definition stk8ba58_reg.h:723
uint8_t slp_en_x
Definition stk8ba58_reg.h:720
Data for INT1 pin output type and active level.
Definition stk8ba58_reg.h:421
uint8_t int1_od
Definition stk8ba58_reg.h:424
uint8_t not_used_01
Definition stk8ba58_reg.h:425
uint8_t int1_lv
Definition stk8ba58_reg.h:423
Data for INT1 pin mode and latched hold-time.
Definition stk8ba58_reg.h:437
uint8_t int_rst
Definition stk8ba58_reg.h:441
uint8_t int_latch
Definition stk8ba58_reg.h:439
uint8_t not_used_01
Definition stk8ba58_reg.h:440
Data for motion detection interrupts enable.
Definition stk8ba58_reg.h:355
uint8_t slp_en_z
Definition stk8ba58_reg.h:359
uint8_t not_used_01
Definition stk8ba58_reg.h:360
uint8_t slp_en_x
Definition stk8ba58_reg.h:357
uint8_t slp_en_y
Definition stk8ba58_reg.h:358
Data for new data interrupt enable.
Definition stk8ba58_reg.h:373
uint8_t not_used_02
Definition stk8ba58_reg.h:377
uint8_t data_en
Definition stk8ba58_reg.h:376
uint8_t not_used_01
Definition stk8ba58_reg.h:375
Data for digital interface parameters of the I2C interface.
Definition stk8ba58_reg.h:514
uint8_t not_used_02
Definition stk8ba58_reg.h:519
uint8_t i2c_wdt_sel
Definition stk8ba58_reg.h:517
uint8_t i2c_wdt_en
Definition stk8ba58_reg.h:518
uint8_t not_used_01
Definition stk8ba58_reg.h:516
Data for motion detection interrupts mapping to INT1 pin.
Definition stk8ba58_reg.h:389
uint8_t not_used_02
Definition stk8ba58_reg.h:394
uint8_t sigmot2int1
Definition stk8ba58_reg.h:391
uint8_t anymot2int1
Definition stk8ba58_reg.h:393
uint8_t not_used_01
Definition stk8ba58_reg.h:392
Data for new data interrupt mapping to INT1 pin.
Definition stk8ba58_reg.h:407
uint8_t data2int1
Definition stk8ba58_reg.h:409
uint8_t not_used_01
Definition stk8ba58_reg.h:410
Data for motion detection interrupts status.
Definition stk8ba58_reg.h:230
uint8_t not_used_02
Definition stk8ba58_reg.h:235
uint8_t sig_mot_sts
Definition stk8ba58_reg.h:232
uint8_t not_used_01
Definition stk8ba58_reg.h:233
uint8_t any_mot_sts
Definition stk8ba58_reg.h:234
Data for new data interrupt status.
Definition stk8ba58_reg.h:248
uint8_t not_used_01
Definition stk8ba58_reg.h:250
uint8_t data_sts
Definition stk8ba58_reg.h:251
Data struct for any-axis offset compensation value.
Definition stk8ba58_reg.h:552
uint8_t comp
Definition stk8ba58_reg.h:554
Data for settings of the offset compensation.
Definition stk8ba58_reg.h:532
uint8_t ofst_rst
Definition stk8ba58_reg.h:535
uint8_t not_used_01
Definition stk8ba58_reg.h:534
Data for any-axis acceleration data (LSB) and the new data flag.
Definition stk8ba58_reg.h:196
uint8_t out
Definition stk8ba58_reg.h:200
uint8_t not_used_01
Definition stk8ba58_reg.h:199
uint8_t new
Definition stk8ba58_reg.h:198
Data struct for any-axis acceleration data (MSB).
Definition stk8ba58_reg.h:218
uint8_t out
Definition stk8ba58_reg.h:220
Data for motion detection and data interrupts mapping to INT1 pin.
Definition stk8ba58_reg.h:707
uint8_t sigmot2int1
Definition stk8ba58_reg.h:708
uint8_t data2int1
Definition stk8ba58_reg.h:710
uint8_t anymot2int1
Definition stk8ba58_reg.h:709
Data for power mode selection and the sleep time duration setting.
Definition stk8ba58_reg.h:316
uint8_t sleep_dur
Definition stk8ba58_reg.h:319
uint8_t not_used_01
Definition stk8ba58_reg.h:318
uint8_t suspend
Definition stk8ba58_reg.h:322
uint8_t not_used_02
Definition stk8ba58_reg.h:320
uint8_t lowpower
Definition stk8ba58_reg.h:321
Data for acceleration sensing range.
Definition stk8ba58_reg.h:288
uint8_t not_used_01
Definition stk8ba58_reg.h:291
uint8_t range
Definition stk8ba58_reg.h:290
Data for skip time (LSB) of the significant motion.
Definition stk8ba58_reg.h:470
uint8_t skip_time
Definition stk8ba58_reg.h:472
Data for skip time (MSB) of the significant motion, interrupt enable.
Definition stk8ba58_reg.h:482
uint8_t any_mot_en
Definition stk8ba58_reg.h:486
uint8_t skip_time
Definition stk8ba58_reg.h:484
uint8_t sig_mot_en
Definition stk8ba58_reg.h:485
uint8_t not_used_01
Definition stk8ba58_reg.h:487
Data for proof time of the significant motion.
Definition stk8ba58_reg.h:500
uint8_t not_used_01
Definition stk8ba58_reg.h:503
uint8_t proof_time
Definition stk8ba58_reg.h:502
Data for number of samples in the slope detection.
Definition stk8ba58_reg.h:453
uint8_t not_used_01
Definition stk8ba58_reg.h:456
uint8_t slp_dur
Definition stk8ba58_reg.h:455