forked from boschsensortec/BMI08x_SensorAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmi08.h
1298 lines (1210 loc) · 40.9 KB
/
bmi08.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 bmi08.h
* @date 2023-03-27
* @version v1.7.1
*
*/
/**
* \ingroup bmi08
* \defgroup bmi08ag BMI08A / BMI08G
*/
#ifndef _BMI08_H
#define _BMI08_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************/
/* header files */
#include "bmi08_defs.h"
/*********************** BMI08x Accelerometer function prototypes ************************/
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiInit Gyro Initialization
* @brief Initialize the sensor and device structure
*/
/*!
* \ingroup bmi08aApiInit
* \page bmi08a_api_bmi08a_init bmi08a_init
* \code
* int8_t bmi08a_init(struct bmi08_dev *dev);
* \endcode
* @details This API is the entry point for accel sensor.
* It performs the selection of I2C/SPI read mechanism according to the
* selected interface and reads the chip-id of accel sensor.
*
* @param[in,out] dev : Structure instance of bmi08_dev.
* @note : Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_init(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiConfig Accel Upload Config File
* @brief Uploads config file onto the device
*/
/*!
* \ingroup bmi08aApiConfig
* \page bmi08a_api_bmi08a_load_config_file bmi08a_load_config_file
* \code
* int8_t bmi08a_load_config_file(struct bmi08_dev *dev);
* \endcode
* @details This API uploads the bmi08 config file onto the device.
*
* @param[in,out] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_load_config_file(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiFConfig Upload Feature Config File
* @brief Uploads config file onto the device
*/
/*!
* \ingroup bmi08aApiFConfig
* \page bmi08a_api_bmi08a_write_feature_config bmi08a_write_feature_config
* \code
* int8_t bmi08a_write_feature_config(uint8_t reg_addr, const uint16_t *reg_data, uint8_t len,
* const struct bmi08_dev *dev);
*
* \endcode
* @details This API writes the feature configuration to the accel sensor.
*
* @param[in] reg_addr : Address offset of the feature setting inside the feature conf region.
* @param[in] reg_data : Feature settings.
* @param[in] len : Number of 16 bit words to be written.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_write_feature_config(uint8_t reg_addr, const uint16_t *reg_data, uint8_t len, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiRegs Accel Data
* @brief Read / Write data from the given register address of accel sensor
*/
/*!
* \ingroup bmi08aApiRegs
* \page bmi08a_api_bmi08a_get_regs bmi08a_get_regs
* \code
* int8_t bmi08a_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint16_t len, const struct bmi08_dev *dev);
* \endcode
* @details This API reads the data from the given register address of accel sensor.
*
* @param[in] reg_addr : Register address from where the data to be read
* @param[out] reg_data : Pointer to data buffer to store the read data.
* @param[in] len : No. of bytes of data to be read.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, struct bmi08_dev *dev);
/*!
* \ingroup bmi08aApiRegs
* \page bmi08a_api_bmi08a_set_regs bmi08a_set_regs
* \code
* int8_t bmi08a_set_regs(uint8_t reg_addr, uint8_t *reg_data, uint16_t len, const struct bmi08_dev *dev);
* \endcode
* @details This API writes the given data to the register address
* of accel sensor.
*
* @param[in] reg_addr : Register address to where the data to be written.
* @param[in] reg_data : Pointer to data buffer which is to be written
* in the sensor.
* @param[in] len : No. of bytes of data to write.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_set_regs(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, struct bmi08_dev *dev);
/*!
* \ingroup bmi08aApiRegs
* \page bmi08a_api_bmi08a_get_i2c_wdt bmi08a_get_i2c_wdt
* \code
* int8_t bmi08a_get_i2c_wdt(uint8_t *i2c_wdt_sel, uint8_t *i2c_wdt_en, struct bmi08_dev *dev);
* \endcode
* @details This API reads the watchdog related information
*
* @param[out] i2c_wdt_sel : Variable to hold i2c_wdt_sel
* @param[out] i2c_wdt_en : Variable to hold i2c_wdt_en
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_i2c_wdt(uint8_t *i2c_wdt_sel, uint8_t *i2c_wdt_en, struct bmi08_dev *dev);
/*!
* \ingroup bmi08aApiRegs
* \page bmi08a_api_bmi08a_get_i2c_wdt bmi08a_set_i2c_wdt
* \code
* int8_t bmi08a_set_i2c_wdt(uint8_t i2c_wdt_sel, uint8_t i2c_wdt_en, struct bmi08_dev *dev);
* \endcode
* @details This API writes the watchdog related information
*
* @param[in] i2c_wdt_sel : Variable to hold i2c_wdt_sel
* @param[in] i2c_wdt_en : Variable to hold i2c_wdt_en
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_set_i2c_wdt(uint8_t i2c_wdt_sel, uint8_t i2c_wdt_en, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiErrorStatus Accel Error status
* @brief Get error status from accel sensor
*/
/*!
* \ingroup bmi08aApiErrorStatus
* \page bmi08a_api_bmi08a_get_error_status bmi08a_get_error_status
* \code
* int8_t bmi08a_get_error_status(struct bmi08_err_reg *err_reg, const struct bmi08_dev *dev);
* \endcode
* @details This API reads the error status from the accel 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 | state (Boot-, power-system).
* | This flag will be reset only by
* | power-on-reset or soft reset.
*************************|***********************************************
* | Value Name Description
* error_code | 000 no_error no error
* | 001 accel_err error in
* | ACCEL_CONF
*************************************************************************
*@endverbatim
*
* @param[out] err_reg : Pointer to structure variable which stores the
* error status read from the sensor.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_error_status(struct bmi08_err_reg *err_reg, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApistatus Accel status
* @brief Read status of accel sensor
*/
/*!
* \ingroup bmi08aApistatus
* \page bmi08a_api_bmi08a_get_status bmi08a_get_status
* \code
* int8_t bmi08a_get_status(uint8_t *status, const struct bmi08_dev *dev);
* \endcode
* @details This API reads the status of the accel sensor.
*
* Below table lists the sensor status flags
*
*@verbatim
*************************************************************************
* Status | Description
***********************************|*************************************
* drdy_accel | Data ready for Accel.
*************************************************************************
*@endverbatim
*
* @param[out] status : Variable used to store the sensor status flags
* which is read from the sensor.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_status(uint8_t *status, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiSoftreset Accel Soft reset
* @brief Performs soft reset of accel sensor
*/
/*!
* \ingroup bmi08aApiSoftreset
* \page bmi08a_api_bmi08a_soft_reset bmi08a_soft_reset
* \code
* int8_t bmi08a_soft_reset(const struct bmi08_dev *dev);
* \endcode
* @details This API resets the accel sensor.
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_soft_reset(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiConf Read accel configurations
* @brief Read / Write configurations of accel sensor
*/
/*!
* \ingroup bmi08aApiConf
* \page bmi08a_api_bmi08a_get_meas_conf bmi08a_get_meas_conf
* \code
* int8_t bmi08a_get_meas_conf(struct bmi08_dev *dev);
* \endcode
* @details This API reads the accel config values ie odr, band width and range from the sensor,
* store it in the bmi08_dev structure instance
* passed by the user.
* @param[in,out] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_meas_conf(struct bmi08_dev *dev);
/*!
* \ingroup bmi08aApiConf
* \page bmi08a_api_bmi08a_set_meas_conf bmi08a_set_meas_conf
* \code
* int8_t bmi08a_set_meas_conf(const struct bmi08_dev *dev);
* \endcode
* @details This API sets the Output data rate and bandwidth
* of accel sensor.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @note : The user must select one among the following macros to
* select range value for BMI085 accel
*
*@verbatim
* config | value
* -------------------------------|---------------------------
* BMI085_ACCEL_RANGE_2G | 0x00
* BMI085_ACCEL_RANGE_4G | 0x01
* BMI085_ACCEL_RANGE_8G | 0x02
* BMI085_ACCEL_RANGE_16G | 0x03
*@endverbatim
*
* @note : The user must select one among the following macros to
* select range value for BMI088 accel
*
*@verbatim
* config | value
* -------------------------------|---------------------------
* BMI088_ACCEL_RANGE_3G | 0x00
* BMI088_ACCEL_RANGE_6G | 0x01
* BMI088_ACCEL_RANGE_12G | 0x02
* BMI088_ACCEL_RANGE_24G | 0x03
*@endverbatim
*
* @note : Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_set_meas_conf(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiPowermode Accel power mode
* @brief Set / Get power mode of accel sensor
*/
/*!
* \ingroup bmi08aApiPowermode
* \page bmi08a_api_bmi08a_get_power_mode bmi08a_get_power_mode
* \code
* int8_t bmi08a_get_power_mode(struct bmi08_dev *dev);
* \endcode
* @details This API reads the accel power mode from the sensor,
* store it in the bmi08_dev structure instance
* passed by the user.
* @param[in,out] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_power_mode(struct bmi08_dev *dev);
/*!
* \ingroup bmi08aApiPowermode
* \page bmi08a_api_bmi08a_set_power_mode bmi08a_set_power_mode
* \code
* int8_t bmi08a_set_power_mode(const struct bmi08_dev *dev);
* \endcode
* @details This API sets the power mode of the accel sensor.
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_set_power_mode(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiData Accel Data
* @brief Read data from accel sensor
*/
/*!
* \ingroup bmi08aApiData
* \page bmi08a_api_bmi08a_get_data bmi08a_get_data
* \code
* int8_t bmi08a_get_data(struct bmi08_sensor_data *accel, const struct bmi08_dev *dev);
* \endcode
* @details This API reads the accel data from the sensor,
* store it in the bmi08_sensor_data structure instance
* passed by the user.
*
* @param[out] accel : Structure pointer to store accel data
* @param[in] dev : Structure instance of bmi08_dev.
*
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_data(struct bmi08_sensor_data *accel, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiIntConf Accel Interrupt Config
* @brief Configures interrupt of accel sensor
*/
/*!
* \ingroup bmi08aApiIntConf
* \page bmi08a_api_bmi08a_set_int_config bmi08a_set_int_config
* \code
* int8_t bmi08a_set_int_config(const struct bmi08_accel_int_channel_cfg *int_config, const struct bmi08_dev *dev);
* \endcode
* @details This API configures the necessary accel interrupt
* based on the user settings in the bmi08_accel_int_channel_cfg
* structure instance.
*
* @param[in] int_config : Structure instance of bmi08_accel_int_channel_cfg.
* @param[in] dev : Structure instance of bmi08_dev.
* @note : Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_set_int_config(const struct bmi08_accel_int_channel_cfg *int_config, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiAccelTemp Accel Temperature
* @brief Read temperature from accel sensor
*/
/*!
* \ingroup bmi08aApiAccelTemp
* \page bmi08a_api_bmi08a_get_sensor_temperature bmi08a_get_sensor_temperature
* \code
* int8_t bmi08a_get_sensor_temperature(const struct bmi08_dev *dev, int32_t *sensor_temp);
* \endcode
* @details This API reads the temperature of the sensor in degree Celcius.
*
* @param[in] dev : Structure instance of bmi08_dev.
* @param[out] sensor_temp : Pointer to store sensor temperature in degree Celcius
*
* @note Temperature data output must be divided by a factor of 1000
*
* Consider sensor_temp = 19520 , Then the actual temperature is 19.520 degree Celsius
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_sensor_temperature(struct bmi08_dev *dev, int32_t *sensor_temp);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiaccelsensortime Accel sensor time
* @brief Read sensor time of accel sensor
*/
/*!
* \ingroup bmi08aApiaccelsensortime
* \page bmi08a_api_bmi08a_get_sensor_time bmi08a_get_sensor_time
* \code
* int8_t bmi08a_get_sensor_time(const struct bmi08_dev *dev, uint32_t *sensor_time);
* \endcode
* @details This API reads the sensor time of the accel sensor.
*
* @param[in] dev : Structure instance of bmi08_dev.
* @param[out] sensor_time : Pointer to store sensor time
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_sensor_time(struct bmi08_dev *dev, uint32_t *sensor_time);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiSync Data Synchronization
* @brief Enable / Disable data synchronization
*/
/*!
* \ingroup bmi08aApiSync
* \page bmi08a_api_bmi08a_configure_data_synchronization bmi08a_configure_data_synchronization
* \code
* int8_t bmi08a_configure_data_synchronization(struct bmi08_data_sync_cfg sync_cfg, struct bmi08_dev *dev);
* \endcode
* @details This API is used to enable/disable the data synchronization
* feature.
*
* @param[in] sync_cfg : Configure sync feature
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_configure_data_synchronization(struct bmi08_data_sync_cfg sync_cfg, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiSyncData Sync Data
* @brief Synchronizes accel and gyro data from the sensor
*/
/*!
* \ingroup bmi08aApiSyncData
* \page bmi08a_api_bmi08a_get_synchronized_data bmi08a_get_synchronized_data
* \code
* int8_t bmi08a_get_synchronized_data(struct bmi08_sensor_data *accel,
* struct bmi08_sensor_data *gyro,
* const struct bmi08_dev *dev);
*
* \endcode
* @details This API reads the synchronized accel & gyro data from the sensor,
* store it in the bmi08_sensor_data structure instance
* passed by the user.
*
* @param[out] accel : Structure pointer to store accel data
* @param[out] gyro : Structure pointer to store gyro data
* @param[in] dev : Structure instance of bmi08_dev.
*
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_get_synchronized_data(struct bmi08_sensor_data *accel,
struct bmi08_sensor_data *gyro,
struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08aApiInt interrupt
* @brief Configuring Interrupts
*/
/*!
* \ingroup bmi08aApiInt
* \page bmi08a_api_bmi08a_set_data_sync_int_config bmi08a_set_data_sync_int_config
* \code
* int8_t bmi08a_set_data_sync_int_config(const struct bmi08_int_cfg *int_config, const struct bmi08_dev *dev);
* \endcode
* @details This API configures the synchronization interrupt
* based on the user settings in the bmi08_int_cfg
* structure instance.
*
* @param[in] int_config : Structure instance of accel bmi08_int_cfg.
* @param[in] dev : Structure instance of bmi08_dev.
* @note : Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08a_set_data_sync_int_config(const struct bmi08_int_cfg *int_config, struct bmi08_dev *dev);
/*!
* \ingroup bmi08aApiInt
* \page bmi08a_api_bmi08a_get_data_int_status bmi08a_get_data_int_status
* \code
* int8_t bmi08a_get_data_int_status(uint8_t *int_status, struct bmi08_dev *dev);
* \endcode
* @details This API is to get accel feature interrupt status
*
* @param[out] int_status : Variable to store interrupt status
* @param[in] dev : Structure instance of bmi08_dev
*
*@verbatim
*-----------------------------------------
* int_status | Interrupt
*-----------------------------------------
* 0x01 | Fifo full
* 0x02 | Fifo watermark
* 0x08 | Accel data ready
*------------------------------------------
*@endverbatim
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi08a_get_data_int_status(uint8_t *int_status, struct bmi08_dev *dev);
/*********************** BMI088 Gyroscope function prototypes ****************************/
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiInit Gyro Initialization
* @brief Initialize the sensor and device structure
*/
/*!
* \ingroup bmi08gApiInit
* \page bmi08g_api_bmi08g_init bmi08g_init
* \code
* int8_t bmi08g_init(struct bmi08_dev *dev);
* \endcode
* @details This API is the entry point for gyro sensor.
* It performs the selection of I2C/SPI read mechanism according to the
* selected interface and reads the chip-id of gyro sensor.
*
* @param[in,out] dev : Structure instance of bmi08_dev.
* @note : Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_init(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiRegs Gyro Data
* @brief Read / Write data from the given register address of gyro sensor
*/
/*!
* \ingroup bmi08gApiRegs
* \page bmi08g_api_bmi08g_get_regs bmi08g_get_regs
* \code
* int8_t bmi08g_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint16_t len, const struct bmi08_dev *dev);
* \endcode
* @details This API reads the data from the given register address of gyro sensor.
*
* @param[in] reg_addr : Register address from where the data to be read
* @param[out] reg_data : Pointer to data buffer to store the read data.
* @param[in] len : No. of bytes of data to be read.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_get_regs(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, struct bmi08_dev *dev);
/*!
* \ingroup bmi08gApiRegs
* \page bmi08g_api_bmi08g_set_regs bmi08g_set_regs
* \code
* int8_t bmi08g_set_regs(uint8_t reg_addr, uint8_t *reg_data, uint16_t len, const struct bmi08_dev *dev);
* \endcode
* @details This API writes the given data to the register address
* of gyro sensor.
*
* @param[in] reg_addr : Register address to where the data to be written.
* @param[in] reg_data : Pointer to data buffer which is to be written
* in the sensor.
* @param[in] len : No. of bytes of data to write.
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_set_regs(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiSoftreset gyro Soft reset
* @brief Performs soft reset of gyro sensor
*/
/*!
* \ingroup bmi08gApiSoftreset
* \page bmi08g_api_bmi08g_soft_reset bmi08g_soft_reset
* \code
* int8_t bmi08g_soft_reset(const struct bmi08_dev *dev);
* \endcode
* @details This API resets the gyro sensor.
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_soft_reset(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiConf Read gyro configurations
* @brief Read / Write configurations of gyro sensor
*/
/*!
* \ingroup bmi08gApiConf
* \page bmi08g_api_bmi08g_get_meas_conf bmi08g_get_meas_conf
* \code
* int8_t bmi08g_get_meas_conf(struct bmi08_dev *dev);
* \endcode
* @details This API reads the gyro odr and range from the sensor,
* store it in the bmi08_dev structure instance
* passed by the user.
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @note : band width also updated, which is same as odr
* Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_get_meas_conf(struct bmi08_dev *dev);
/*!
* \ingroup bmi08gApiConf
* \page bmi08g_api_bmi08g_set_meas_conf bmi08g_get_meas_conf
* \code
* int8_t bmi08g_set_meas_conf(struct bmi08_dev *dev);
* \endcode
* @details This API sets the output data rate, range and bandwidth
* of gyro sensor.
*
* @param[in] dev : Structure instance of bmi08_dev.
* @note : Refer user guide for detailed info.
*
* @note : No need to give the band width parameter,
* odr will update the band width.
* Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_set_meas_conf(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiPowermode Gyro power mode
* @brief Set / Get power mode of gyro sensor
*/
/*!
* \ingroup bmi08gApiPowermode
* \page bmi08g_api_bmi08g_get_power_mode bmi08g_get_power_mode
* \code
* int8_t bmi08g_get_power_mode(struct bmi08_dev *dev);
* \endcode
* @details This API gets the power mode of the gyro sensor and store it
* inside the instance of bmi08_dev passed by the user.
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_get_power_mode(struct bmi08_dev *dev);
/*!
* \ingroup bmi08gApiPowermode
* \page bmi08g_api_bmi08g_set_power_mode bmi08g_set_power_mode
* \code
* int8_t bmi08g_set_power_mode(const struct bmi08_dev *dev);
* \endcode
* @details This API sets the power mode of the gyro sensor.
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_set_power_mode(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiData Gyro data
* @brief Read Gyro data
*/
/*!
* \ingroup bmi08gApiData
* \page bmi08g_api_bmi08g_get_data bmi08g_get_data
* \code
* int8_t bmi08g_get_data(struct bmi08_sensor_data *gyro, const struct bmi08_dev *dev);
* \endcode
* @details This API reads the gyro data from the sensor,
* store it in the bmi08_sensor_data structure instance
* passed by the user.
*
* @param[out] gyro : Structure pointer to store gyro data
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_get_data(struct bmi08_sensor_data *gyro, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiIntconfig Gyro interrupt config
* @brief Set interrupt configurations of gyro sensor
*/
/*!
* \ingroup bmi08gApiIntconfig
* \page bmi08g_api_bmi08g_set_int_config bmi08g_set_int_config
* \code
* int8_t bmi08g_set_int_config(const struct bmi08_gyro_int_channel_cfg *int_config, const struct bmi08_dev *dev);
* \endcode
* @details This API configures the necessary gyro interrupt
* based on the user settings in the bmi08_gyro_int_channel_cfg
* structure instance.
*
* @param[in] int_config : Structure instance of bmi08_gyro_int_channel_cfg.
* @param[in] dev : Structure instance of bmi08_dev.
* @note : Refer user guide for detailed info.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_set_int_config(const struct bmi08_gyro_int_channel_cfg *int_config, struct bmi08_dev *dev);
/*!
* \ingroup bmi08gApiIntconfig
* \page bmi08g_api_bmi08g_get_data_int_status bmi08g_get_data_int_status
* \code
* int8_t bmi08g_get_data_int_status(uint8_t *int_status, struct bmi08_dev *dev);
* \endcode
* @details This API is to get accel feature interrupt status
*
* @param[out] int_status : Variable to store interrupt status
* @param[in] dev : Structure instance of bmi08_dev
*
*@verbatim
*----------------------------------------------
* int_status | Interrupt
*----------------------------------------------
* 0x08 | Gyro data ready
* 0x10 | Fifo full, Fifo watermark
*----------------------------------------------
*@endverbatim
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bmi08g_get_data_int_status(uint8_t *int_status, struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiSelftest Gyro self test
* @brief Set / Get power mode of gyro sensor
*/
/*!
* \ingroup bmi08gApiSelftest
* \page bmi08g_api_bmi08g_perform_selftest bmi08g_perform_selftest
* \code
* int8_t bmi08g_perform_selftest(const struct bmi08_dev *dev);
* \endcode
* @details This API checks whether the self test functionality of the
* gyro sensor is working or not
*
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval < 0 -> Fail
*
*/
int8_t bmi08g_perform_selftest(struct bmi08_dev *dev);
/**
* \ingroup bmi08ag
* \defgroup bmi08gApiFIFO FIFO
* @brief Access and extract FIFO gyro data
*/
/*!
* \ingroup bmi08gApiFIFO
* \page bmi08g_api_bmi08g_get_fifo_config bmi08g_get_fifo_config
* \code
* int8_t bmi08g_get_fifo_config(struct bmi08_gyr_fifo_config *fifo_conf, , struct bmi08_dev *dev);
* \endcode
* @details This API is used to get the fifo configurations like fifo mode, fifo data select, etc
*
* @param[in] fifo_conf : Structure pointer to fifo configurations
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval >0 -> Warning
* @retval <0 -> Fail
*/
int8_t bmi08g_get_fifo_config(struct bmi08_gyr_fifo_config *fifo_conf, struct bmi08_dev *dev);
/*!
* \ingroup bmi08gApiFIFO
* \page bmi08g_api_bmi08g_set_fifo_config bmi08g_set_fifo_config
* \code
* int8_t bmi08g_set_fifo_config(const struct bmi08_gyr_fifo_config *fifo_conf, , struct bmi08_dev *dev);
* \endcode
* @details This API is used to set the fifo configurations like fifo mode, fifo data select, etc
*
* @param[in] fifo_conf : Structure pointer to fifo configurations
* @param[in] dev : Structure instance of bmi08_dev.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval >0 -> Warning
* @retval <0 -> Fail
*/
int8_t bmi08g_set_fifo_config(const struct bmi08_gyr_fifo_config *fifo_conf, struct bmi08_dev *dev);
/*!
* \ingroup bmi08gApiFIFO
* \page bmi08g_api_bmi08g_get_fifo_length bmi08g_get_fifo_length
* \code
* int8_t bmi08g_get_fifo_length(const struct bmi08_gyr_fifo_config *fifo_config, struct bmi08_fifo_frame *fifo);
* \endcode
* @details This API is used to get fifo length
*
* @param[in] fifo_config : Structure instance of bmi08_gyr_fifo_config
* @param[in] fifo : Structure instance of bmi08_fifo_frame.
*
* @return Result of API execution status
* @retval 0 -> Success
* @retval >0 -> Warning
* @retval <0 -> Fail
*/
int8_t bmi08g_get_fifo_length(const struct bmi08_gyr_fifo_config *fifo_config, struct bmi08_fifo_frame *fifo);