-
Notifications
You must be signed in to change notification settings - Fork 5
/
bmi323.h
1716 lines (1616 loc) · 57 KB
/
bmi323.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Copyright (c) 2023 Bosch Sensortec GmbH. All rights reserved.
*
* BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @file bmi323.h
* @date 2023-02-17
* @version v2.1.0
*
*/
/*!
* @defgroup bmi323 BMI323
*/
/**
* \ingroup bmi323
* \defgroup bmi3 BMI3
* @brief Sensor driver for BMI3 sensor
*/
#ifndef _BMI323_H
#define _BMI323_H
/*! CPP guard */
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
/*! Header files
****************************************************************************/
#include "bmi3.h"
#include "bmi323_defs.h"
/***************************************************************************/
/*! BMI3XY User Interface function prototypes
****************************************************************************/
/**
* \ingroup bmi323
* \defgroup bmi323ApiInit Initialization
* @brief Initialize the sensor and device structure
*/
/*!
* \ingroup bmi323ApiInit
* \page bmi323_api_bmi323_init bmi323_init
* \code
* int8_t bmi323_init(struct bmi3_dev *dev);
* \endcode
* @details This API is the entry point for bmi323 sensor. It also reads the chip-id of
* the sensor.
*
* @param[in,out] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_init(struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiRegs Registers
* @brief Set / Get data from the given register address of the sensor
*/
/*!
* \ingroup bmi323ApiRegs
* \page bmi323_api_bmi323_set_regs bmi323_set_regs
* \code
* int8_t bmi323_set_regs(uint8_t reg_addr, const uint8_t *data, uint16_t len, struct bmi3_dev *dev);
* \endcode
* @details This API writes data to the given register address of bmi323 sensor.
*
* @param[in] reg_addr : Register address to which the data is written.
* @param[in] data : Pointer to data buffer in which data to be written
* is stored.
* @param[in] len : No. of bytes of data to be written.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_set_regs(uint8_t reg_addr, const uint8_t *data, uint16_t len, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiRegs
* \page bmi323_api_bmi323_get_regs bmi323_get_regs
* \code
* int8_t bmi323_get_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, struct bmi3_dev *dev);
* \endcode
* @details This API reads the data from the given register address of bmi323
* sensor.
*
* @param[in] reg_addr : Register address from which data is read.
* @param[out] data : Pointer to data buffer where read data is stored.
* @param[in] len : No. of bytes of data to be read.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @note For most of the registers auto address increment applies, with the
* exception of a few special registers, which trap the address.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ContextSel Context switch
* @brief This API writes the configurations of context feature.
*/
/*!
* \ingroup bmi323ContextSel
* \page bmi323_api_bmi323_context_switch_selection bmi323_context_switch_selection
* \code
* int8_t bmi323_context_switch_selection(uint8_t context_sel, struct bmi3_dev *dev);
* \endcode
*
* @details This API writes the configurations of context feature for smart phone, wearables and hearables.
*
* @param[in] context_sel : Variable to select the context feature between smart phone, wearables and hearables.
*
* @Note: Default is wearable feature.
*@verbatim
*---------------------------|------------------------
* context_sel | Values
*---------------------------|------------------------
* BMI323_SMART_PHONE_SEL | 0
*---------------------------|------------------------
* BMI323_WEARABLE_SEL | 1
*---------------------------|------------------------
* BMI323_HEARABLE_SEL | 2
*---------------------------|------------------------
*@endverbatim
*
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_context_switch_selection(uint8_t context_sel, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiSR Soft-reset
* @brief Set / Get data from the given register address of the sensor
*/
/*!
* \ingroup bmi323ApiSR
* \page bmi323_api_bmi323_soft_reset bmi323_soft_reset
* \code
* int8_t bmi323_soft_reset(struct bmi3_dev *dev);
* \endcode
* @details This API resets bmi323 sensor. All registers are overwritten with
* their default values.
*
* @note If selected interface is SPI, an extra dummy byte is read to bring the
* interface back to SPI from default, after the soft-reset command.
*
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_soft_reset(struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiInt Interrupt
* @brief Interrupt operations of the sensor
*/
/*!
* \ingroup bmi323ApiInt
* \page bmi323_api_bmi323_set_int_pin_config bmi323_set_int_pin_config
* \code
* int8_t bmi323_set_int_pin_config(const struct bmi3_int_pin_config *int_cfg, struct bmi3_dev *dev);
* \endcode
* @details This API sets:
* 1) The input output configuration of the selected interrupt pin:
* INT1 or INT2.
* 2) The interrupt mode: Permanently latched or non-latched.
*
* @param[in] int_cfg : Structure instance of bmi3_int_pin_config.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_set_int_pin_config(const struct bmi3_int_pin_config *int_cfg, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiInt
* \page bmi323_api_bmi323_get_int_pin_config bmi323_get_int_pin_config
* \code
* int8_t bmi323_get_int_pin_config(struct bmi3_int_pin_config *int_cfg, struct bmi3_dev *dev);
* \endcode
* @details This API gets:
* 1) The input output configuration of the selected interrupt pin:
* INT1 or INT2.
* 2) The interrupt mode: Permanently latched or non-latched.
*
* @param[in,out] int_cfg : Structure instance of bmi3_int_pin_config.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_int_pin_config(struct bmi3_int_pin_config *int_cfg, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiInt
* \page bmi323_api_bmi323_get_int1_status bmi323_get_int_status
* \code
* int8_t bmi323_get_int1_status(uint16_t *int_status, struct bmi3_dev *dev);
* \endcode
* @details This API gets the interrupt 1 status of both feature and data
* interrupts.
*
* @param[out] int_status : Pointer to get the status of the interrupts.
* @param[in] dev : Structure instance of bmi3_dev.
*
*@verbatim
* int_status | Status
* -------------|------------
* 0x0001 | BMI3_INT_STATUS_NO_MOTION
* 0x0002 | BMI3_INT_STATUS_ANY_MOTION
* 0x0004 | BMI3_INT_STATUS_FLAT
* 0x0008 | BMI3_INT_STATUS_ORIENTATION
* 0x0010 | BMI3_INT_STATUS_STEP_DETECTOR
* 0x0020 | BMI3_INT_STATUS_STEP_COUNTER
* 0x0040 | BMI3_INT_STATUS_SIG_MOTION
* 0x0080 | BMI3_INT_STATUS_TILT
* 0x0100 | BMI3_INT_STATUS_TAP
* 0x0200 | BMI3_INT_STATUS_I3C
* 0x0400 | BMI3_INT_STATUS_ERR
* 0x0800 | BMI3_INT_STATUS_TEMP_DRDY
* 0x1000 | BMI3_INT_STATUS_GYR_DRDY
* 0x2000 | BMI3_INT_STATUS_ACC_DRDY
* 0x4000 | BMI3_INT_STATUS_FWM
* 0x8000 | BMI3_INT_STATUS_FFULL
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_int1_status(uint16_t *int_status, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiInt
* \page bmi323_api_bmi323_get_int2_status bmi323_get_int_status
* \code
* int8_t bmi323_get_int2_status(uint16_t *int_status, struct bmi3_dev *dev);
* \endcode
* @details This API gets the interrupt 2 status of both feature and data
* interrupts.
*
* @param[out] int_status : Pointer to get the status of the interrupts.
* @param[in] dev : Structure instance of bmi3_dev.
*
*@verbatim
* int_status | Status
* -------------|------------
* 0x0001 | BMI3_INT_STATUS_NO_MOTION
* 0x0002 | BMI3_INT_STATUS_ANY_MOTION
* 0x0004 | BMI3_INT_STATUS_FLAT
* 0x0008 | BMI3_INT_STATUS_ORIENTATION
* 0x0010 | BMI3_INT_STATUS_STEP_DETECTOR
* 0x0020 | BMI3_INT_STATUS_STEP_COUNTER
* 0x0040 | BMI3_INT_STATUS_SIG_MOTION
* 0x0080 | BMI3_INT_STATUS_TILT
* 0x0100 | BMI3_INT_STATUS_TAP
* 0x0200 | BMI3_INT_STATUS_I3C
* 0x0400 | BMI3_INT_STATUS_ERR
* 0x0800 | BMI3_INT_STATUS_TEMP_DRDY
* 0x1000 | BMI3_INT_STATUS_GYR_DRDY
* 0x2000 | BMI3_INT_STATUS_ACC_DRDY
* 0x4000 | BMI3_INT_STATUS_FWM
* 0x8000 | BMI3_INT_STATUS_FFULL
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_int2_status(uint16_t *int_status, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiRemap Remap Axes
* @brief Set / Get remap axes values from the sensor
*/
/*!
* \ingroup bmi323ApiRemap
* \page bmi323_api_bmi323_get_remap_axes bmi323_get_remap_axes
* \code
* int8_t bmi323_get_remap_axes(struct bmi3_remap *remapped_axis, struct bmi3_dev *dev);
* \endcode
* @details This API gets the re-mapped x, y and z axes from the sensor and
* updates the values in the device structure.
*
* @param[out] remapped_axis : Structure that stores re-mapped axes.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_remap_axes(struct bmi3_axes_remap *remapped_axis, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiRemap
* \page bmi323_api_bmi323_set_remap_axes bmi323_set_remap_axes
* \code
* int8_t bmi323_set_remap_axes(const struct bmi3_remap remapped_axis, struct bmi3_dev *dev);
* \endcode
* @details This API sets the re-mapped x, y and z axes to the sensor and
* updates them in the device structure.
*
* @param[in] remapped_axis : Structure that stores re-mapped axes.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_set_remap_axes(const struct bmi3_axes_remap remapped_axis, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiErrorStatus Error Status
* @brief Read error status of the sensor
*/
/*!
* \ingroup bmi323ApiErrorStatus
* \page bmi323_api_bmi323_get_error_status bmi323_get_error_status
* \code
* int8_t bmi323_get_error_status(struct bmi3_err_reg *err_reg, struct bmi3_dev *dev);;
* \endcode
* @details This API reads the error status from the sensor.
*
* Below table mention the types of error which can occur in the sensor.
*
*@verbatim
*************************************************************************
* Error | Description
*************************|***********************************************
* | Fatal Error, chip is not in operational
* fatal_err | state (Boot-, power-system).
* | This flag will be reset only by
* | power-on-reset or soft-reset.
*************************|***********************************************
* |
* feat_eng_ovrld | Overload of the feature engine detected.
* | This flag is clear-on-read.
* |
*************************|***********************************************
* | Watchdog timer of the feature engine triggered.
* feat_eng_wd | This flag is clear-on-read.
* |
*************************|***********************************************
* |
* acc_conf_err | Unsupported accelerometer configuration
* | set by user.This flag will be reset
* | when configuration has been corrected.
*************************|***********************************************
* |
* gyr_conf_err | Unsupported gyroscope configuration
* | set by user.This flag will be reset
* | when configuration has been corrected.
*************************|***********************************************
* |
* i3c_error0 | SDR parity error or read abort condition
* | (maximum clock stall time for I3C Read
* | Transfer) occurred.
*************************|***********************************************
* |
* i3c_error3 | This flag is clear-on-read type. It is
* | cleared automatically once read.
* |
*************************|***********************************************
*
*@endverbatim
*
* @param[in,out] err_reg : Pointer to structure variable which stores the
* error status read from the sensor.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status.
*
* @return 0 -> Success
* @return < 0 -> Fail
*
*/
int8_t bmi323_get_error_status(struct bmi3_err_reg *err_reg, struct bmi3_dev *dev);
/*! @cond DOXYGEN_SUPRESS */
/**
* \ingroup bmi323
* \defgroup bmi323ApiSensor Feature Set
* @brief Enable / Disable features of the sensor
*/
/*!
* \ingroup bmi323ApiSensor
* \page bmi323_api_bmi323_select_sensor bmi323_select_sensor
* \code
* int8_t bmi323_select_sensor(struct bmi3_feature_enable *enable, struct bmi3_dev *dev);
* \endcode
* @details This API selects the sensors/features to be enabled or disabled.
*
* @param[in] enable : Enable the sensor.
* @param[in, out] dev : Structure instance of bmi3_dev.
*
* @note Sensors/features that can be enabled.
*
*@verbatim
* sens_list | Values
* -------------------------|-----------
* BMI323_ACCEL | 0
* BMI323_GYRO | 1
* BMI323_SIG_MOTION | 2
* BMI323_ANY_MOTION | 3
* BMI323_NO_MOTION | 4
* BMI323_STEP_DETECTOR | 5
* BMI323_STEP_COUNTER | 6
* BMI323_TILT | 7
* BMI323_ORIENTATION | 8
* BMI323_FLAT | 9
* BMI323_WAKEUP | 10
* BMI323_I3C_SYC | 11
* BMI323_GYRO_GAIN_UPDATE | 12
* BMI323_TEMP | 16
* BMI323_GYRO_SELF_OFF | 18
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_select_sensor(struct bmi3_feature_enable *enable, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiSensorConfig Sensor Configuration
* @brief Enable / Disable feature configuration of the sensor
*/
/*!
* \ingroup bmi323ApiSensorConfig
* \page bmi323_api_bmi323_set_sensor_config bmi323_set_sensor_config
* \code
* int8_t bmi323_set_sensor_config(struct bmi3_sens_config *sens_cfg, uint8_t n_sens, struct bmi3_dev *dev);
* \endcode
* @details This API sets the sensor/feature configuration.
*
* @param[in] sens_cfg : Structure instance of bmi3_sens_config.
* @param[in] n_sens : Number of sensors selected.
* @param[in, out] dev : Structure instance of bmi3_dev.
*
* @note Sensors/features that can be configured
*
*@verbatim
* sens_list | Values
* ------------------------------|-----------
* BMI323_ACCEL | 0
* BMI323_GYRO | 1
* BMI323_SIG_MOTION | 2
* BMI323_ANY_MOTION | 3
* BMI323_NO_MOTION | 4
* BMI323_STEP_DETECTOR | 5
* BMI323_STEP_COUNTER | 6
* BMI323_TILT | 7
* BMI323_ORIENTATION | 8
* BMI323_FLAT | 9
* BMI323_WAKEUP | 10
* BMI323_I3C_SYC | 11
* BMI323_GYRO_GAIN_UPDATE | 12
* BMI323_ALT_ACCEL | 13
* BMI323_ALT_GYRO | 14
* BMI323_ALT_AUTO_CONFIG | 15
* BMI323_TEMP | 16
* BMI323_GYRO_SELF_OFF | 18
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_set_sensor_config(struct bmi3_sens_config *sens_cfg, uint8_t n_sens, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiSensorConfig
* \page bmi323_api_bmi323_get_sensor_config bmi323_get_sensor_config
* \code
* int8_t bmi323_get_sensor_config(struct bmi3_sens_config *sens_cfg, uint8_t n_sens, struct bmi3_dev *dev);
* \endcode
* @details This API gets the sensor/feature configuration.
*
* @param[in] sens_cfg : Structure instance of bmi3_sens_config.
* @param[in] n_sens : Number of sensors selected.
* @param[in, out] dev : Structure instance of bmi3_dev.
*
* @note Sensors/features whose configurations can be read.
*
*@verbatim
* sens_list | Values
* ------------------------------|-----------
* BMI323_ACCEL | 0
* BMI323_GYRO | 1
* BMI323_SIG_MOTION | 2
* BMI323_ANY_MOTION | 3
* BMI323_NO_MOTION | 4
* BMI323_STEP_DETECTOR | 5
* BMI323_STEP_COUNTER | 6
* BMI323_TILT | 7
* BMI323_ORIENTATION | 8
* BMI323_FLAT | 9
* BMI323_WAKEUP | 10
* BMI323_I3C_SYC | 11
* BMI323_GYRO_GAIN_UPDATE | 12
* BMI323_ALT_ACCEL | 13
* BMI323_ALT_GYRO | 14
* BMI323_ALT_AUTO_CONFIG | 15
* BMI323_TEMP | 16
* BMI323_GYRO_SELF_OFF | 18
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_sensor_config(struct bmi3_sens_config *sens_cfg, uint8_t n_sens, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiSensorD Sensor Data
* @brief Get sensor data
*/
/*!
* \ingroup bmi323ApiSensorD
* \page bmi323_api_bmi323_get_sensor_data bmi323_get_sensor_data
* \code
* int8_t bmi323_get_sensor_data(struct bmi3_sensor_data *sensor_data, uint8_t n_sens, struct bmi3_dev *dev);
* \endcode
* @details This API gets the sensor/feature data for accelerometer, gyroscope,
* step counter, orientation, single, double, triple tap, gyroscope user-gain update
* and gyroscope cross sensitivity.
*
* @param[out] sensor_data : Structure instance of bmi3_sensor_data.
* @param[in] n_sens : Number of sensors selected.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @note Sensors/features whose data can be read
*
*@verbatim
* sens_list | Values
* ---------------------------|-----------
* BMI323_ACCEL | 0
* BMI323_GYRO | 1
* BMI323_STEP_COUNTER | 6
* BMI323_ORIENTATION | 8
* BMI323_WAKEUP | 10
* BMI323_GYRO_GAIN_UPDATE | 12
* BMI323_GYRO_CROSS_SENSE | 21
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_sensor_data(struct bmi3_sensor_data *sensor_data, uint8_t n_sens, struct bmi3_dev *dev);
/*!
* \ingroup bmi323ApiInt
* \page bmi323_api_bmi323_map_interrupt bmi323_map_interrupt
* \code
* int8_t bmi323_map_interrupt(struct bmi3_map_int map_int, struct bmi3_dev *dev);
* \endcode
* @details This API maps/unmaps feature interrupts to that of interrupt pins.
*
* @param[in] map_int : Structure instance of bmi3_map_int.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
*@verbatim
* feature_int | Mask values
* ------------------------|---------------------
* BMI3_NO_MOTION_OUT | 0x0003
* BMI3_ANY_MOTION_OUT | 0x000C
* BMI3_FLAT_OUT | 0x0030
* BMI3_ORIENTATION_OUT | 0x00C0
* BMI3_STEP_DETECTOR_OUT | 0x0300
* BMI3_STEP_COUNTER_OUT | 0x0C00
* BMI3_SIG_MOTION_OUT | 0x3000
* BMI3_TILT_OUT | 0xC000
* BMI3_TAP_OUT | 0x0003
* BMI3_I3C_OUT | 0x000C
* BMI3_ERR_STATUS | 0x0030
* BMI3_TEMP_DRDY_INT | 0x00C0
* BMI3_GYR_DRDY_INT | 0x0300
* BMI3_ACC_DRDY_INT | 0xC000
* BMI3_FWM_INT | 0x3000
* BMI3_FFULL_INT | 0xC000
*@endverbatim
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_map_interrupt(struct bmi3_map_int map_int, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiCmd Command Register
* @brief Write commands to the sensor
*/
/*!
* \ingroup bmi323ApiCmd
* \page bmi323_api_bmi323_set_command_register bmi323_set_command_register
* \code
* int8_t bmi323_set_command_register(uint16_t command, struct bmi3_dev *dev);
* \endcode
* @details This API writes the available sensor specific commands to the sensor.
*
* @param[in] command : Commands to be given to the sensor.
* @param[in] dev : Structure instance of bmi3_dev.
*
*@verbatim
* Commands | Values
* -------------------------------|---------------------
* BMI3_CMD_SELF_TEST_TRIGGER | 0x0100
* BMI3_CMD_SELF_CALIB_TRIGGER | 0x0101
* BMI3_CMD_SELF_CALIB_ABORT | 0x0200
* BMI3_CMD_I3C_TCSYNC_UPDATE | 0x0201
* BMI3_CMD_AXIS_MAP_UPDATE | 0x300
* BMI3_CMD_USR_GAIN_OFFS_UPDATE | 0x301
* BMI3_CMD_1 | 0x64AD
* BMI3_CMD_2 | 0xD3AC
* BMI3_CMD_SOFT_RESET | 0xDEAF
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_set_command_register(uint16_t command, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiSensorTime Sensor Time
* @brief Read sensor time of the sensor
*/
/*!
* \ingroup bmi323ApiSensorTime
* \page bmi323_api_bmi323_get_sensor_time bmi323_get_sensor_time
* \code
* int8_t bmi323_get_sensor_time(uint32_t *sensor_time, struct bmi3_dev *dev);
* \endcode
* @details This API reads the sensor time of Sensor time gets updated
* with every update of data register or FIFO.
*
* @param[in] sensor_time : Pointer variable which stores sensor time
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_sensor_time(uint32_t *sensor_time, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiTemperature Temperature
* @brief Read temperature of the sensor.
*/
/*!
* \ingroup bmi323ApiTemperature
* \page bmi323_api_bmi323_get_temperature_data bmi323_get_temperature_data
* \code
* int8_t bmi323_get_temperature_data(uint16_t *temp_data, struct bmi3_dev *dev);
* \endcode
* @details This API reads the raw temperature data from the register and can be
* converted into degree celsius using the below formula.
* Formula: temperature_value = (float)(((float)((int16_t)temperature_data)) / 512.0) + 23.0
*
* @note Enable accel or gyro to read temperature
*
* @param[out] temp_data : Pointer variable which stores the raw temperature value.
* @param[in] dev : Structure instance of bmi3_dev.
*
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi323_get_temperature_data(uint16_t *temp_data, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apireadfifodata readfifodata
* @brief Read fifo data
*/
/*!
* \ingroup bmi3ApiFIFO
* \page bmi3xo_api_bmi323_read_fifo_data bmi323_read_fifo_data
* \code
* int8_t bmi323_read_fifo_data(struct bmi3_fifo_frame *fifo, struct bmi3_dev *dev);
* \endcode
* @details This API reads FIFO data.
*
* @param[in, out] fifo : Structure instance of bmi3_fifo_frame.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @note APS has to be disabled before calling this function.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_read_fifo_data(struct bmi3_fifo_frame *fifo, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apiextractaccel extract accel
* @brief Read fifo data
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_extract_accel bmi323_extract_accel
* \code
* int8_t bmi323_extract_accel(struct bmi3_fifo_sens_axes_data *accel_data,
* struct bmi3_fifo_frame *fifo,
* const struct bmi3_dev *dev)
* \endcode
* @details This API parses and extracts the accelerometer frames from FIFO data read by
* the "bmi323_read_fifo_data" API and stores it in the "accel_data" structure
* instance.
*
* @param[out] accel_data : Structure instance of bmi3_fifo_sens_axes_data
* where the parsed data bytes are stored.
* @param[in,out] fifo : Structure instance of bmi3_fifo_frame.
* @param[in] dev : Structure instance of bmi3_dev
*
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_extract_accel(struct bmi3_fifo_sens_axes_data *accel_data,
struct bmi3_fifo_frame *fifo,
const struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apiextractgyro extract gyro
* @brief Read fifo data
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_extract_gyro bmi323_extract_gyro
* \code
* int8_t bmi323_extract_gyro(struct bmi3_fifo_sens_axes_data *gyro_data,
* struct bmi3_fifo_frame *fifo,
* const struct bmi3_dev *dev)
* \endcode
* @details This API parses and extracts the gyro frames from FIFO data read by
* the "bmi323_read_fifo_data" API and stores it in the "gyro_data" structure
* instance.
*
* @param[out] gyro_data : Structure instance of bmi3_fifo_sens_axes_data
* where the parsed data bytes are stored.
* @param[in,out] fifo : Structure instance of bmi3_fifo_frame.
* @param[in] dev : Structure instance of bmi3_dev
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_extract_gyro(struct bmi3_fifo_sens_axes_data *gyro_data,
struct bmi3_fifo_frame *fifo,
const struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apiextracttemperature extract temperature
* @brief Read fifo data
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_extract_temperature bmi323_extract_temperature
* \code
* int8_t bmi323_extract_temperature(struct bmi3_fifo_temperature_data *temp_data,
* struct bmi3_fifo_frame *fifo,
* const struct bmi3_dev *dev)
* \endcode
* @details This API parses and extracts the temperature frames from FIFO data read by
* the "bmi323_read_fifo_data" API and stores it in the "temp_data" structure
* instance.
*
* @param[out] temp_data : Structure instance of bmi3_fifo_temperature_data
* where the parsed data bytes are stored.
* @param[in,out] fifo : Structure instance of bmi3_fifo_frame.
* @param[in] dev : Structure instance of bmi3_dev
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_extract_temperature(struct bmi3_fifo_temperature_data *temp_data,
struct bmi3_fifo_frame *fifo,
const struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apisetfifowatermark fifowatermark
* @brief Read fifo data
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_set_fifo_wm bmi323_set_fifo_wm
* \code
* int8_t bmi323_set_fifo_wm(uint16_t fifo_wm, struct bmi3_dev *dev);
* \endcode
* @details This API sets the FIFO water-mark level in words.
*
* @param[in] fifo_wm : Variable to set FIFO water-mark level in words.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_set_fifo_wm(uint16_t fifo_wm, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apisetfifowatermark fifo watermark
* @brief Read fifo data
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_get_fifo_wm bmi323_get_fifo_wm
* \code
* int8_t bmi323_get_fifo_wm(uint16_t *fifo_wm, struct bmi3_dev *dev);
* \endcode
* @details This API reads the FIFO water-mark level in words.
*
* @param[out] fifo_wm : Variable to get FIFO water-mark level in words.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_get_fifo_wm(uint16_t *fifo_wm, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiFIFO FIFO
* @brief FIFO operations of the sensor
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_set_fifo_config bmi323_set_fifo_config
* \code
* int8_t bmi323_set_fifo_config(uint16_t config, uint8_t enable, struct bmi3_dev *dev);
* \endcode
* @details This API sets the FIFO configuration in the sensor.
*
* @param[in] config : FIFO configurations to be enabled/disabled.
* @param[in] enable : Enable/Disable FIFO configurations.
* @param[in] dev : Structure instance of bmi3_dev.
*
*@verbatim
* enable | Description
* ---------------|---------------
* BMI323_DISABLE | Disables FIFO configuration.
* BMI323_ENABLE | Enables FIFO configuration.
*@endverbatim
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_set_fifo_config(uint16_t config, uint8_t enable, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323ApiFIFO FIFO
* @brief FIFO operations of the sensor
*/
/*!
* \ingroup bmi323ApiFIFO
* \page bmi323_api_bmi323_get_fifo_config bmi323_get_fifo_config
* \code
* int8_t bmi323_get_fifo_config(uint16_t *fifo_config, struct bmi3_dev *dev);
* \endcode
* @details This API sets the FIFO configuration in the sensor.
*
* @param[out] fifo_config : Get FIFO configurations to be enabled/disabled.
* @param[in] dev : Structure instance of bmi3_dev.
*
* @return Result of API execution status
*
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi323_get_fifo_config(uint16_t *fifo_config, struct bmi3_dev *dev);
/**
* \ingroup bmi323
* \defgroup bmi323Apigetfifolen getfifolength