-
Notifications
You must be signed in to change notification settings - Fork 5
/
bmm350_defs.h
1166 lines (1020 loc) · 52.7 KB
/
bmm350_defs.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 bmm350_defs.h
* @date 2023-05-26
* @version v1.4.0
*
*/
#ifndef _BMM350_DEFS_H
#define _BMM350_DEFS_H
/*************************** Header files *******************************/
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/kernel.h>
#else
#include <stdint.h>
#include <stddef.h>
#endif
/***************************** Common Macros *****************************/
#ifdef __KERNEL__
#if !defined(UINT8_C) && !defined(INT8_C)
#define INT8_C(x) S8_C(x)
#define UINT8_C(x) U8_C(x)
#endif
#if !defined(UINT16_C) && !defined(INT16_C)
#define INT16_C(x) S16_C(x)
#define UINT16_C(x) U16_C(x)
#endif
#if !defined(INT32_C) && !defined(UINT32_C)
#define INT32_C(x) S32_C(x)
#define UINT32_C(x) U32_C(x)
#endif
#if !defined(INT64_C) && !defined(UINT64_C)
#define INT64_C(x) S64_C(x)
#define UINT64_C(x) U64_C(x)
#endif
#endif
/*! C standard macros */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *) 0)
#endif
#endif
/******************************************************************************/
/*! @name Compiler switch macros Definitions */
/******************************************************************************/
/************************* General Macro definitions ***************************/
/* Macro to SET and GET BITS of a register*/
#define BMM350_SET_BITS(reg_data, bitname, data) \
((reg_data & ~(bitname##_MSK)) | \
((data << bitname##_POS) & bitname##_MSK))
#define BMM350_GET_BITS(reg_data, bitname) ((reg_data & (bitname##_MSK)) >> (bitname##_POS))
#define BMM350_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK))
#define BMM350_SET_BITS_POS_0(reg_data, bitname, data) \
((reg_data & ~(bitname##_MSK)) | \
(data & bitname##_MSK))
#ifndef BMM350_INTF_RET_TYPE
#define BMM350_INTF_RET_TYPE int8_t
#endif
/*! Chip id of BMM350 */
#define BMM350_CHIP_ID UINT8_C(0x33)
/*! Variant ID of BMM350 */
#define BMM350_MIN_VAR UINT8_C(0x10)
/************************* Sensor interface success code **************************/
#define BMM350_INTF_RET_SUCCESS INT8_C(0)
/************************* API success code **************************/
#define BMM350_OK INT8_C(0)
/* API error codes */
#define BMM350_E_NULL_PTR INT8_C(-1)
#define BMM350_E_COM_FAIL INT8_C(-2)
#define BMM350_E_DEV_NOT_FOUND INT8_C(-3)
#define BMM350_E_INVALID_CONFIG INT8_C(-4)
#define BMM350_E_BAD_PAD_DRIVE INT8_C(-5)
#define BMM350_E_RESET_UNFINISHED INT8_C(-6)
#define BMM350_E_INVALID_INPUT INT8_C(-7)
#define BMM350_E_SELF_TEST_INVALID_AXIS INT8_C(-8)
#define BMM350_E_OTP_BOOT INT8_C(-9)
#define BMM350_E_OTP_PAGE_RD INT8_C(-10)
#define BMM350_E_OTP_PAGE_PRG INT8_C(-11)
#define BMM350_E_OTP_SIGN INT8_C(-12)
#define BMM350_E_OTP_INV_CMD INT8_C(-13)
#define BMM350_E_OTP_UNDEFINED INT8_C(-14)
#define BMM350_E_ALL_AXIS_DISABLED INT8_C(-15)
#define BMM350_E_PMU_CMD_VALUE INT8_C(-16)
#define BMM350_NO_ERROR UINT8_C(0)
/************************* Sensor delay time settings in microseconds **************************/
#define BMM350_SOFT_RESET_DELAY UINT32_C(24000)
#define BMM350_MAGNETIC_RESET_DELAY UINT32_C(40000)
#define BMM350_START_UP_TIME_FROM_POR UINT32_C(3000)
#define BMM350_GOTO_SUSPEND_DELAY UINT32_C(6000)
#define BMM350_SUSPEND_TO_NORMAL_DELAY UINT32_C(38000)
#define BMM350_SUS_TO_FORCEDMODE_NO_AVG_DELAY UINT32_C(15000)
#define BMM350_SUS_TO_FORCEDMODE_AVG_2_DELAY UINT32_C(17000)
#define BMM350_SUS_TO_FORCEDMODE_AVG_4_DELAY UINT32_C(20000)
#define BMM350_SUS_TO_FORCEDMODE_AVG_8_DELAY UINT32_C(28000)
#define BMM350_SUS_TO_FORCEDMODE_FAST_NO_AVG_DELAY UINT32_C(4000)
#define BMM350_SUS_TO_FORCEDMODE_FAST_AVG_2_DELAY UINT32_C(5000)
#define BMM350_SUS_TO_FORCEDMODE_FAST_AVG_4_DELAY UINT32_C(9000)
#define BMM350_SUS_TO_FORCEDMODE_FAST_AVG_8_DELAY UINT32_C(16000)
#define BMM350_UPD_OAE_DELAY UINT16_C(1000)
#define BMM350_BR_DELAY UINT16_C(14000)
#define BMM350_FGR_DELAY UINT16_C(18000)
/************************ Length macros ************************/
#define BMM350_OTP_DATA_LENGTH UINT8_C(32)
#define BMM350_READ_BUFFER_LENGTH UINT8_C(127)
#define BMM350_MAG_TEMP_DATA_LEN UINT8_C(12)
/************************ Averaging macros **********************/
#define BMM350_AVG_NO_AVG UINT8_C(0x0)
#define BMM350_AVG_2 UINT8_C(0x1)
#define BMM350_AVG_4 UINT8_C(0x2)
#define BMM350_AVG_8 UINT8_C(0x3)
/******************************* ODR **************************/
#define BMM350_ODR_400HZ UINT8_C(0x2)
#define BMM350_ODR_200HZ UINT8_C(0x3)
#define BMM350_ODR_100HZ UINT8_C(0x4)
#define BMM350_ODR_50HZ UINT8_C(0x5)
#define BMM350_ODR_25HZ UINT8_C(0x6)
#define BMM350_ODR_12_5HZ UINT8_C(0x7)
#define BMM350_ODR_6_25HZ UINT8_C(0x8)
#define BMM350_ODR_3_125HZ UINT8_C(0x9)
#define BMM350_ODR_1_5625HZ UINT8_C(0xA)
/********************* Power modes *************************/
#define BMM350_PMU_CMD_SUS UINT8_C(0x00)
#define BMM350_PMU_CMD_NM UINT8_C(0x01)
#define BMM350_PMU_CMD_UPD_OAE UINT8_C(0x02)
#define BMM350_PMU_CMD_FM UINT8_C(0x03)
#define BMM350_PMU_CMD_FM_FAST UINT8_C(0x04)
#define BMM350_PMU_CMD_FGR UINT8_C(0x05)
#define BMM350_PMU_CMD_FGR_FAST UINT8_C(0x06)
#define BMM350_PMU_CMD_BR UINT8_C(0x07)
#define BMM350_PMU_CMD_BR_FAST UINT8_C(0x08)
#define BMM350_PMU_CMD_NM_TC UINT8_C(0x09)
#define BMM350_PMU_STATUS_0 UINT8_C(0x0)
#define BMM350_DISABLE UINT8_C(0x0)
#define BMM350_ENABLE UINT8_C(0x1)
#define BMM350_CMD_NOP UINT8_C(0x0)
#define BMM350_CMD_SOFTRESET UINT8_C(0xB6)
#define BMM350_TARGET_PAGE_PAGE0 UINT8_C(0x0)
#define BMM350_TARGET_PAGE_PAGE1 UINT8_C(0x1)
#define BMM350_INT_MODE_LATCHED UINT8_C(0x1)
#define BMM350_INT_MODE_PULSED UINT8_C(0x0)
#define BMM350_INT_POL_ACTIVE_HIGH UINT8_C(0x1)
#define BMM350_INT_POL_ACTIVE_LOW UINT8_C(0x0)
#define BMM350_INT_OD_PUSHPULL UINT8_C(0x1)
#define BMM350_INT_OD_OPENDRAIN UINT8_C(0x0)
#define BMM350_INT_OUTPUT_EN_OFF UINT8_C(0x0)
#define BMM350_INT_OUTPUT_EN_ON UINT8_C(0x1)
#define BMM350_INT_DRDY_EN UINT8_C(0x1)
#define BMM350_INT_DRDY_DIS UINT8_C(0x0)
#define BMM350_MR_MR1K8 UINT8_C(0x0)
#define BMM350_MR_MR2K1 UINT8_C(0x1)
#define BMM350_MR_MR1K5 UINT8_C(0x2)
#define BMM350_MR_MR0K6 UINT8_C(0x3)
#define BMM350_SEL_DTB1X_PAD_PAD_INT UINT8_C(0x0)
#define BMM350_SEL_DTB1X_PAD_PAD_BYP UINT8_C(0x1)
#define BMM350_TMR_TST_HIZ_VTMR_VTMR_ON UINT8_C(0x0)
#define BMM350_TMR_TST_HIZ_VTMR_VTMR_HIZ UINT8_C(0x1)
#define BMM350_LSB_MASK UINT16_C(0x00FF)
#define BMM350_MSB_MASK UINT16_C(0xFF00)
/********************** Pad drive strength ************************/
#define BMM350_PAD_DRIVE_WEAKEST UINT8_C(0)
#define BMM350_PAD_DRIVE_STRONGEST UINT8_C(7)
/********************** I2C Register Addresses ************************/
/*! Register to set I2C address to LOW */
#define BMM350_I2C_ADSEL_SET_LOW UINT8_C(0x14)
/*! Register to set I2C address to HIGH */
#define BMM350_I2C_ADSEL_SET_HIGH UINT8_C(0x15)
#define BMM350_DUMMY_BYTES UINT8_C(2)
/********************** Register Addresses ************************/
#define BMM350_REG_CHIP_ID UINT8_C(0x00)
#define BMM350_REG_REV_ID UINT8_C(0x01)
#define BMM350_REG_ERR_REG UINT8_C(0x02)
#define BMM350_REG_PAD_CTRL UINT8_C(0x03)
#define BMM350_REG_PMU_CMD_AGGR_SET UINT8_C(0x04)
#define BMM350_REG_PMU_CMD_AXIS_EN UINT8_C(0x05)
#define BMM350_REG_PMU_CMD UINT8_C(0x06)
#define BMM350_REG_PMU_CMD_STATUS_0 UINT8_C(0x07)
#define BMM350_REG_PMU_CMD_STATUS_1 UINT8_C(0x08)
#define BMM350_REG_I3C_ERR UINT8_C(0x09)
#define BMM350_REG_I2C_WDT_SET UINT8_C(0x0A)
#define BMM350_REG_TRSDCR_REV_ID UINT8_C(0x0D)
#define BMM350_REG_TC_SYNC_TU UINT8_C(0x21)
#define BMM350_REG_TC_SYNC_ODR UINT8_C(0x22)
#define BMM350_REG_TC_SYNC_TPH_1 UINT8_C(0x23)
#define BMM350_REG_TC_SYNC_TPH_2 UINT8_C(0x24)
#define BMM350_REG_TC_SYNC_DT UINT8_C(0x25)
#define BMM350_REG_TC_SYNC_ST_0 UINT8_C(0x26)
#define BMM350_REG_TC_SYNC_ST_1 UINT8_C(0x27)
#define BMM350_REG_TC_SYNC_ST_2 UINT8_C(0x28)
#define BMM350_REG_TC_SYNC_STATUS UINT8_C(0x29)
#define BMM350_REG_INT_CTRL UINT8_C(0x2E)
#define BMM350_REG_INT_CTRL_IBI UINT8_C(0x2F)
#define BMM350_REG_INT_STATUS UINT8_C(0x30)
#define BMM350_REG_MAG_X_XLSB UINT8_C(0x31)
#define BMM350_REG_MAG_X_LSB UINT8_C(0x32)
#define BMM350_REG_MAG_X_MSB UINT8_C(0x33)
#define BMM350_REG_MAG_Y_XLSB UINT8_C(0x34)
#define BMM350_REG_MAG_Y_LSB UINT8_C(0x35)
#define BMM350_REG_MAG_Y_MSB UINT8_C(0x36)
#define BMM350_REG_MAG_Z_XLSB UINT8_C(0x37)
#define BMM350_REG_MAG_Z_LSB UINT8_C(0x38)
#define BMM350_REG_MAG_Z_MSB UINT8_C(0x39)
#define BMM350_REG_TEMP_XLSB UINT8_C(0x3A)
#define BMM350_REG_TEMP_LSB UINT8_C(0x3B)
#define BMM350_REG_TEMP_MSB UINT8_C(0x3C)
#define BMM350_REG_SENSORTIME_XLSB UINT8_C(0x3D)
#define BMM350_REG_SENSORTIME_LSB UINT8_C(0x3E)
#define BMM350_REG_SENSORTIME_MSB UINT8_C(0x3F)
#define BMM350_REG_OTP_CMD_REG UINT8_C(0x50)
#define BMM350_REG_OTP_DATA_MSB_REG UINT8_C(0x52)
#define BMM350_REG_OTP_DATA_LSB_REG UINT8_C(0x53)
#define BMM350_REG_OTP_STATUS_REG UINT8_C(0x55)
#define BMM350_REG_TMR_SELFTEST_USER UINT8_C(0x60)
#define BMM350_REG_CTRL_USER UINT8_C(0x61)
#define BMM350_REG_CMD UINT8_C(0x7E)
/*********************** Macros for OVWR ***************************/
#define BMM350_REG_OVWR_VALUE_ANA_0 UINT8_C(0x3A)
#define BMM350_REG_OVWR_EN_ANA_0 UINT8_C(0x3B)
/*********************** Macros for bit masking ***************************/
#define BMM350_CHIP_ID_OTP_MSK UINT8_C(0xf)
#define BMM350_CHIP_ID_OTP_POS UINT8_C(0x0)
#define BMM350_CHIP_ID_FIXED_MSK UINT8_C(0xf0)
#define BMM350_CHIP_ID_FIXED_POS UINT8_C(0x4)
#define BMM350_REV_ID_MAJOR_MSK UINT8_C(0xf0)
#define BMM350_REV_ID_MAJOR_POS UINT8_C(0x4)
#define BMM350_REV_ID_MINOR_MSK UINT8_C(0xf)
#define BMM350_REV_ID_MINOR_POS UINT8_C(0x0)
#define BMM350_PMU_CMD_ERROR_MSK UINT8_C(0x1)
#define BMM350_PMU_CMD_ERROR_POS UINT8_C(0x0)
#define BMM350_BOOT_UP_ERROR_MSK UINT8_C(0x2)
#define BMM350_BOOT_UP_ERROR_POS UINT8_C(0x1)
#define BMM350_DRV_MSK UINT8_C(0x7)
#define BMM350_DRV_POS UINT8_C(0x0)
#define BMM350_AVG_MSK UINT8_C(0x30)
#define BMM350_AVG_POS UINT8_C(0x4)
#define BMM350_ODR_MSK UINT8_C(0xf)
#define BMM350_ODR_POS UINT8_C(0x0)
#define BMM350_PMU_CMD_MSK UINT8_C(0xf)
#define BMM350_PMU_CMD_POS UINT8_C(0x0)
#define BMM350_EN_X_MSK UINT8_C(0x01)
#define BMM350_EN_X_POS UINT8_C(0x0)
#define BMM350_EN_Y_MSK UINT8_C(0x02)
#define BMM350_EN_Y_POS UINT8_C(0x1)
#define BMM350_EN_Z_MSK UINT8_C(0x04)
#define BMM350_EN_Z_POS UINT8_C(0x2)
#define BMM350_EN_XYZ_MSK UINT8_C(0x7)
#define BMM350_EN_XYZ_POS UINT8_C(0x0)
#define BMM350_PMU_CMD_BUSY_MSK UINT8_C(0x1)
#define BMM350_PMU_CMD_BUSY_POS UINT8_C(0x0)
#define BMM350_ODR_OVWR_MSK UINT8_C(0x2)
#define BMM350_ODR_OVWR_POS UINT8_C(0x1)
#define BMM350_AVG_OVWR_MSK UINT8_C(0x4)
#define BMM350_AVG_OVWR_POS UINT8_C(0x2)
#define BMM350_PWR_MODE_IS_NORMAL_MSK UINT8_C(0x8)
#define BMM350_PWR_MODE_IS_NORMAL_POS UINT8_C(0x3)
#define BMM350_CMD_IS_ILLEGAL_MSK UINT8_C(0x10)
#define BMM350_CMD_IS_ILLEGAL_POS UINT8_C(0x4)
#define BMM350_PMU_CMD_VALUE_MSK UINT8_C(0xE0)
#define BMM350_PMU_CMD_VALUE_POS UINT8_C(0x5)
#define BMM350_PMU_ODR_S_MSK UINT8_C(0xf)
#define BMM350_PMU_ODR_S_POS UINT8_C(0x0)
#define BMM350_PMU_AVG_S_MSK UINT8_C(0x30)
#define BMM350_PMU_AVG_S_POS UINT8_C(0x4)
#define BMM350_I3C_ERROR_0_MSK UINT8_C(0x1)
#define BMM350_I3C_ERROR_0_POS UINT8_C(0x0)
#define BMM350_I3C_ERROR_3_MSK UINT8_C(0x8)
#define BMM350_I3C_ERROR_3_POS UINT8_C(0x3)
#define BMM350_I2C_WDT_EN_MSK UINT8_C(0x1)
#define BMM350_I2C_WDT_EN_POS UINT8_C(0x0)
#define BMM350_I2C_WDT_SEL_MSK UINT8_C(0x2)
#define BMM350_I2C_WDT_SEL_POS UINT8_C(0x1)
#define BMM350_TRSDCR_REV_ID_OTP_MSK UINT8_C(0x3)
#define BMM350_TRSDCR_REV_ID_OTP_POS UINT8_C(0x0)
#define BMM350_TRSDCR_REV_ID_FIXED_MSK UINT8_C(0xfc)
#define BMM350_TRSDCR_REV_ID_FIXED_POS UINT8_C(0x2)
#define BMM350_PAGING_EN_MSK UINT8_C(0x80)
#define BMM350_PAGING_EN_POS UINT8_C(0x7)
#define BMM350_DRDY_DATA_REG_MSK UINT8_C(0x4)
#define BMM350_DRDY_DATA_REG_POS UINT8_C(0x2)
#define BMM350_INT_MODE_MSK UINT8_C(0x1)
#define BMM350_INT_MODE_POS UINT8_C(0x0)
#define BMM350_INT_POL_MSK UINT8_C(0x2)
#define BMM350_INT_POL_POS UINT8_C(0x1)
#define BMM350_INT_OD_MSK UINT8_C(0x4)
#define BMM350_INT_OD_POS UINT8_C(0x2)
#define BMM350_INT_OUTPUT_EN_MSK UINT8_C(0x8)
#define BMM350_INT_OUTPUT_EN_POS UINT8_C(0x3)
#define BMM350_DRDY_DATA_REG_EN_MSK UINT8_C(0x80)
#define BMM350_DRDY_DATA_REG_EN_POS UINT8_C(0x7)
#define BMM350_DRDY_INT_MAP_TO_IBI_MSK UINT8_C(0x1)
#define BMM350_DRDY_INT_MAP_TO_IBI_POS UINT8_C(0x0)
#define BMM350_CLEAR_DRDY_INT_STATUS_UPON_IBI_MSK UINT8_C(0x10)
#define BMM350_CLEAR_DRDY_INT_STATUS_UPON_IBI_POS UINT8_C(0x4)
#define BMM350_TC_SYNC_TU_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_ODR_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_TPH_1_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_TPH_2_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_DT_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_ST_0_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_ST_1_MSK UINT8_C(0xff)
#define BMM350_TC_SYNC_ST_2_MSK UINT8_C(0xff)
#define BMM350_CFG_FORCE_SOSC_EN_MSK UINT8_C(0x4)
#define BMM350_CFG_FORCE_SOSC_EN_POS UINT8_C(0x2)
#define BMM350_ST_IGEN_EN_MSK UINT8_C(0x1)
#define BMM350_ST_IGEN_EN_POS UINT8_C(0x0)
#define BMM350_ST_N_MSK UINT8_C(0x2)
#define BMM350_ST_N_POS UINT8_C(0x1)
#define BMM350_ST_P_MSK UINT8_C(0x4)
#define BMM350_ST_P_POS UINT8_C(0x2)
#define BMM350_IST_EN_X_MSK UINT8_C(0x8)
#define BMM350_IST_EN_X_POS UINT8_C(0x3)
#define BMM350_IST_EN_Y_MSK UINT8_C(0x10)
#define BMM350_IST_EN_Y_POS UINT8_C(0x4)
#define BMM350_CFG_SENS_TIM_AON_MSK UINT8_C(0x1)
#define BMM350_CFG_SENS_TIM_AON_POS UINT8_C(0x0)
#define BMM350_DATA_X_7_0_MSK UINT8_C(0xff)
#define BMM350_DATA_X_7_0_POS UINT8_C(0x0)
#define BMM350_DATA_X_15_8_MSK UINT8_C(0xff)
#define BMM350_DATA_X_15_8_POS UINT8_C(0x0)
#define BMM350_DATA_X_23_16_MSK UINT8_C(0xff)
#define BMM350_DATA_X_23_16_POS UINT8_C(0x0)
#define BMM350_DATA_Y_7_0_MSK UINT8_C(0xff)
#define BMM350_DATA_Y_7_0_POS UINT8_C(0x0)
#define BMM350_DATA_Y_15_8_MSK UINT8_C(0xff)
#define BMM350_DATA_Y_15_8_POS UINT8_C(0x0)
#define BMM350_DATA_Y_23_16_MSK UINT8_C(0xff)
#define BMM350_DATA_Y_23_16_POS UINT8_C(0x0)
#define BMM350_DATA_Z_7_0_MSK UINT8_C(0xff)
#define BMM350_DATA_Z_7_0_POS UINT8_C(0x0)
#define BMM350_DATA_Z_15_8_MSK UINT8_C(0xff)
#define BMM350_DATA_Z_15_8_POS UINT8_C(0x0)
#define BMM350_DATA_Z_23_16_MSK UINT8_C(0xff)
#define BMM350_DATA_Z_23_16_POS UINT8_C(0x0)
#define BMM350_DATA_T_7_0_MSK UINT8_C(0xff)
#define BMM350_DATA_T_7_0_POS UINT8_C(0x0)
#define BMM350_DATA_T_15_8_MSK UINT8_C(0xff)
#define BMM350_DATA_T_15_8_POS UINT8_C(0x0)
#define BMM350_DATA_T_23_16_MSK UINT8_C(0xff)
#define BMM350_DATA_T_23_16_POS UINT8_C(0x0)
#define BMM350_DATA_ST_7_0_MSK UINT8_C(0xff)
#define BMM350_DATA_ST_7_0_POS UINT8_C(0x0)
#define BMM350_DATA_ST_15_8_MSK UINT8_C(0xff)
#define BMM350_DATA_ST_15_8_POS UINT8_C(0x0)
#define BMM350_DATA_ST_23_16_MSK UINT8_C(0xff)
#define BMM350_DATA_ST_23_16_POS UINT8_C(0x0)
#define BMM350_SIGN_INVERT_T_MSK UINT8_C(0x10)
#define BMM350_SIGN_INVERT_T_POS UINT8_C(0x4)
#define BMM350_SIGN_INVERT_X_MSK UINT8_C(0x20)
#define BMM350_SIGN_INVERT_X_POS UINT8_C(0x5)
#define BMM350_SIGN_INVERT_Y_MSK UINT8_C(0x40)
#define BMM350_SIGN_INVERT_Y_POS UINT8_C(0x6)
#define BMM350_SIGN_INVERT_Z_MSK UINT8_C(0x80)
#define BMM350_SIGN_INVERT_Z_POS UINT8_C(0x7)
#define BMM350_DIS_BR_NM_MSK UINT8_C(0x1)
#define BMM350_DIS_BR_NM_POS UINT8_C(0x0)
#define BMM350_DIS_FGR_NM_MSK UINT8_C(0x2)
#define BMM350_DIS_FGR_NM_POS UINT8_C(0x1)
#define BMM350_DIS_CRST_AT_ALL_MSK UINT8_C(0x4)
#define BMM350_DIS_CRST_AT_ALL_POS UINT8_C(0x2)
#define BMM350_DIS_BR_FM_MSK UINT8_C(0x8)
#define BMM350_DIS_BR_FM_POS UINT8_C(0x3)
#define BMM350_FRC_EN_BUFF_MSK UINT8_C(0x1)
#define BMM350_FRC_EN_BUFF_POS UINT8_C(0x0)
#define BMM350_FRC_INA_EN1_MSK UINT8_C(0x2)
#define BMM350_FRC_INA_EN1_POS UINT8_C(0x1)
#define BMM350_FRC_INA_EN2_MSK UINT8_C(0x4)
#define BMM350_FRC_INA_EN2_POS UINT8_C(0x2)
#define BMM350_FRC_ADC_EN_MSK UINT8_C(0x8)
#define BMM350_FRC_ADC_EN_POS UINT8_C(0x3)
#define BMM350_FRC_INA_RST_MSK UINT8_C(0x10)
#define BMM350_FRC_INA_RST_POS UINT8_C(0x4)
#define BMM350_FRC_ADC_RST_MSK UINT8_C(0x20)
#define BMM350_FRC_ADC_RST_POS UINT8_C(0x5)
#define BMM350_FRC_INA_XSEL_MSK UINT8_C(0x1)
#define BMM350_FRC_INA_XSEL_POS UINT8_C(0x0)
#define BMM350_FRC_INA_YSEL_MSK UINT8_C(0x2)
#define BMM350_FRC_INA_YSEL_POS UINT8_C(0x1)
#define BMM350_FRC_INA_ZSEL_MSK UINT8_C(0x4)
#define BMM350_FRC_INA_ZSEL_POS UINT8_C(0x2)
#define BMM350_FRC_ADC_TEMP_EN_MSK UINT8_C(0x8)
#define BMM350_FRC_ADC_TEMP_EN_POS UINT8_C(0x3)
#define BMM350_FRC_TSENS_EN_MSK UINT8_C(0x10)
#define BMM350_FRC_TSENS_EN_POS UINT8_C(0x4)
#define BMM350_DSENS_FM_MSK UINT8_C(0x20)
#define BMM350_DSENS_FM_POS UINT8_C(0x5)
#define BMM350_DSENS_SEL_MSK UINT8_C(0x40)
#define BMM350_DSENS_SEL_POS UINT8_C(0x6)
#define BMM350_DSENS_SHORT_MSK UINT8_C(0x80)
#define BMM350_DSENS_SHORT_POS UINT8_C(0x7)
#define BMM350_ERR_MISS_BR_DONE_MSK UINT8_C(0x1)
#define BMM350_ERR_MISS_BR_DONE_POS UINT8_C(0x0)
#define BMM350_ERR_MISS_FGR_DONE_MSK UINT8_C(0x2)
#define BMM350_ERR_MISS_FGR_DONE_POS UINT8_C(0x1)
#define BMM350_TST_CHAIN_LN_MODE_MSK UINT8_C(0x1)
#define BMM350_TST_CHAIN_LN_MODE_POS UINT8_C(0x0)
#define BMM350_TST_CHAIN_LP_MODE_MSK UINT8_C(0x2)
#define BMM350_TST_CHAIN_LP_MODE_POS UINT8_C(0x1)
#define BMM350_EN_OVWR_TMR_IF_MSK UINT8_C(0x1)
#define BMM350_EN_OVWR_TMR_IF_POS UINT8_C(0x0)
#define BMM350_TMR_CKTRIGB_MSK UINT8_C(0x2)
#define BMM350_TMR_CKTRIGB_POS UINT8_C(0x1)
#define BMM350_TMR_DO_BR_MSK UINT8_C(0x4)
#define BMM350_TMR_DO_BR_POS UINT8_C(0x2)
#define BMM350_TMR_DO_FGR_MSK UINT8_C(0x18)
#define BMM350_TMR_DO_FGR_POS UINT8_C(0x3)
#define BMM350_TMR_EN_OSC_MSK UINT8_C(0x80)
#define BMM350_TMR_EN_OSC_POS UINT8_C(0x7)
#define BMM350_VCM_TRIM_X_MSK UINT8_C(0x1f)
#define BMM350_VCM_TRIM_X_POS UINT8_C(0x0)
#define BMM350_VCM_TRIM_Y_MSK UINT8_C(0x1f)
#define BMM350_VCM_TRIM_Y_POS UINT8_C(0x0)
#define BMM350_VCM_TRIM_Z_MSK UINT8_C(0x1f)
#define BMM350_VCM_TRIM_Z_POS UINT8_C(0x0)
#define BMM350_VCM_TRIM_DSENS_MSK UINT8_C(0x1f)
#define BMM350_VCM_TRIM_DSENS_POS UINT8_C(0x0)
#define BMM350_TWLB_MSK UINT8_C(0x30)
#define BMM350_TWLB_POS UINT8_C(0x4)
#define BMM350_PRG_PLS_TIM_MSK UINT8_C(0x30)
#define BMM350_PRG_PLS_TIM_POS UINT8_C(0x4)
#define BMM350_OTP_OVWR_EN_MSK UINT8_C(0x1)
#define BMM350_OTP_OVWR_EN_POS UINT8_C(0x0)
#define BMM350_OTP_MEM_CLK_MSK UINT8_C(0x2)
#define BMM350_OTP_MEM_CLK_POS UINT8_C(0x1)
#define BMM350_OTP_MEM_CS_MSK UINT8_C(0x4)
#define BMM350_OTP_MEM_CS_POS UINT8_C(0x2)
#define BMM350_OTP_MEM_PGM_MSK UINT8_C(0x8)
#define BMM350_OTP_MEM_PGM_POS UINT8_C(0x3)
#define BMM350_OTP_MEM_RE_MSK UINT8_C(0x10)
#define BMM350_OTP_MEM_RE_POS UINT8_C(0x4)
#define BMM350_SAMPLE_RDATA_PLS_MSK UINT8_C(0x80)
#define BMM350_SAMPLE_RDATA_PLS_POS UINT8_C(0x7)
#define BMM350_CFG_FW_MSK UINT8_C(0x1)
#define BMM350_CFG_FW_POS UINT8_C(0x0)
#define BMM350_EN_BR_X_MSK UINT8_C(0x2)
#define BMM350_EN_BR_X_POS UINT8_C(0x1)
#define BMM350_EN_BR_Y_MSK UINT8_C(0x4)
#define BMM350_EN_BR_Y_POS UINT8_C(0x2)
#define BMM350_EN_BR_Z_MSK UINT8_C(0x8)
#define BMM350_EN_BR_Z_POS UINT8_C(0x3)
#define BMM350_CFG_PAUSE_TIME_MSK UINT8_C(0x30)
#define BMM350_CFG_PAUSE_TIME_POS UINT8_C(0x4)
#define BMM350_CFG_FGR_PLS_DUR_MSK UINT8_C(0xf)
#define BMM350_CFG_FGR_PLS_DUR_POS UINT8_C(0x0)
#define BMM350_CFG_BR_Z_ORDER_MSK UINT8_C(0x10)
#define BMM350_CFG_BR_Z_ORDER_POS UINT8_C(0x4)
#define BMM350_CFG_BR_XY_CHOP_MSK UINT8_C(0x20)
#define BMM350_CFG_BR_XY_CHOP_POS UINT8_C(0x5)
#define BMM350_CFG_BR_PLS_DUR_MSK UINT8_C(0xc0)
#define BMM350_CFG_BR_PLS_DUR_POS UINT8_C(0x6)
#define BMM350_ENABLE_BR_FGR_TEST_MSK UINT8_C(0x1)
#define BMM350_ENABLE_BR_FGR_TEST_POS UINT8_C(0x0)
#define BMM350_SEL_AXIS_MSK UINT8_C(0xe)
#define BMM350_SEL_AXIS_POS UINT8_C(0x1)
#define BMM350_TMR_CFG_TEST_CLK_EN_MSK UINT8_C(0x10)
#define BMM350_TMR_CFG_TEST_CLK_EN_POS UINT8_C(0x4)
#define BMM350_TEST_VAL_BITS_7DOWNTO0_MSK UINT8_C(0xff)
#define BMM350_TEST_VAL_BITS_7DOWNTO0_POS UINT8_C(0x0)
#define BMM350_TEST_VAL_BITS_8_MSK UINT8_C(0x1)
#define BMM350_TEST_VAL_BITS_8_POS UINT8_C(0x0)
#define BMM350_TEST_P_SAMPLE_MSK UINT8_C(0x2)
#define BMM350_TEST_P_SAMPLE_POS UINT8_C(0x1)
#define BMM350_TEST_N_SAMPLE_MSK UINT8_C(0x4)
#define BMM350_TEST_N_SAMPLE_POS UINT8_C(0x2)
#define BMM350_TEST_APPLY_TO_REM_MSK UINT8_C(0x10)
#define BMM350_TEST_APPLY_TO_REM_POS UINT8_C(0x4)
#define BMM350_UFO_TRM_OSC_RANGE_MSK UINT8_C(0xf)
#define BMM350_UFO_TRM_OSC_RANGE_POS UINT8_C(0x0)
#define BMM350_ISO_CHIP_ID_MSK UINT8_C(0x78)
#define BMM350_ISO_CHIP_ID_POS UINT8_C(0x3)
#define BMM350_ISO_I2C_DEV_ID_MSK UINT8_C(0x80)
#define BMM350_ISO_I2C_DEV_ID_POS UINT8_C(0x7)
#define BMM350_I3C_FREQ_BITS_1DOWNTO0_MSK UINT8_C(0xc)
#define BMM350_I3C_FREQ_BITS_1DOWNTO0_POS UINT8_C(0x2)
#define BMM350_I3C_IBI_MDB_SEL_MSK UINT8_C(0x10)
#define BMM350_I3C_IBI_MDB_SEL_POS UINT8_C(0x4)
#define BMM350_TC_ASYNC_EN_MSK UINT8_C(0x20)
#define BMM350_TC_ASYNC_EN_POS UINT8_C(0x5)
#define BMM350_TC_SYNC_EN_MSK UINT8_C(0x40)
#define BMM350_TC_SYNC_EN_POS UINT8_C(0x6)
#define BMM350_I3C_SCL_GATING_EN_MSK UINT8_C(0x80)
#define BMM350_I3C_SCL_GATING_EN_POS UINT8_C(0x7)
#define BMM350_I3C_INACCURACY_BITS_6DOWNTO0_MSK UINT8_C(0x7f)
#define BMM350_I3C_INACCURACY_BITS_6DOWNTO0_POS UINT8_C(0x0)
#define BMM350_EST_EN_X_MSK UINT8_C(0x1)
#define BMM350_EST_EN_X_POS UINT8_C(0x0)
#define BMM350_EST_EN_Y_MSK UINT8_C(0x2)
#define BMM350_EST_EN_Y_POS UINT8_C(0x1)
#define BMM350_CRST_DIS_MSK UINT8_C(0x4)
#define BMM350_CRST_DIS_POS UINT8_C(0x2)
#define BMM350_BR_TFALL_MSK UINT8_C(0x7)
#define BMM350_BR_TFALL_POS UINT8_C(0x0)
#define BMM350_BR_TRISE_MSK UINT8_C(0x70)
#define BMM350_BR_TRISE_POS UINT8_C(0x4)
#define BMM350_TMR_SOFT_START_DIS_MSK UINT8_C(0x80)
#define BMM350_TMR_SOFT_START_DIS_POS UINT8_C(0x7)
#define BMM350_FOSC_LOW_RANGE_MSK UINT8_C(0x80)
#define BMM350_FOSC_LOW_RANGE_POS UINT8_C(0x7)
#define BMM350_VCRST_TRIM_FG_MSK UINT8_C(0x3f)
#define BMM350_VCRST_TRIM_FG_POS UINT8_C(0x0)
#define BMM350_VCRST_TRIM_BR_MSK UINT8_C(0x3f)
#define BMM350_VCRST_TRIM_BR_POS UINT8_C(0x0)
#define BMM350_BG_TRIM_VRP_MSK UINT8_C(0xc0)
#define BMM350_BG_TRIM_VRP_POS UINT8_C(0x6)
#define BMM350_BG_TRIM_TC_MSK UINT8_C(0xf)
#define BMM350_BG_TRIM_TC_POS UINT8_C(0x0)
#define BMM350_BG_TRIM_VRA_MSK UINT8_C(0xf0)
#define BMM350_BG_TRIM_VRA_POS UINT8_C(0x4)
#define BMM350_BG_TRIM_VRD_MSK UINT8_C(0xf)
#define BMM350_BG_TRIM_VRD_POS UINT8_C(0x0)
#define BMM350_OVWR_REF_IB_EN_MSK UINT8_C(0x10)
#define BMM350_OVWR_REF_IB_EN_POS UINT8_C(0x4)
#define BMM350_OVWR_VDDA_EN_MSK UINT8_C(0x20)
#define BMM350_OVWR_VDDA_EN_POS UINT8_C(0x5)
#define BMM350_OVWR_VDDP_EN_MSK UINT8_C(0x40)
#define BMM350_OVWR_VDDP_EN_POS UINT8_C(0x6)
#define BMM350_OVWR_VDDS_EN_MSK UINT8_C(0x80)
#define BMM350_OVWR_VDDS_EN_POS UINT8_C(0x7)
#define BMM350_REF_IB_EN_MSK UINT8_C(0x10)
#define BMM350_REF_IB_EN_POS UINT8_C(0x4)
#define BMM350_VDDA_EN_MSK UINT8_C(0x20)
#define BMM350_VDDA_EN_POS UINT8_C(0x5)
#define BMM350_VDDP_EN_MSK UINT8_C(0x40)
#define BMM350_VDDP_EN_POS UINT8_C(0x6)
#define BMM350_VDDS_EN_MSK UINT8_C(0x80)
#define BMM350_VDDS_EN_POS UINT8_C(0x7)
#define BMM350_OVWR_OTP_PROG_VDD_SW_EN_MSK UINT8_C(0x8)
#define BMM350_OVWR_OTP_PROG_VDD_SW_EN_POS UINT8_C(0x3)
#define BMM350_OVWR_EN_MFE_BG_FILT_BYPASS_MSK UINT8_C(0x10)
#define BMM350_OVWR_EN_MFE_BG_FILT_BYPASS_POS UINT8_C(0x4)
#define BMM350_OTP_PROG_VDD_SW_EN_MSK UINT8_C(0x8)
#define BMM350_OTP_PROG_VDD_SW_EN_POS UINT8_C(0x3)
#define BMM350_CP_COMP_CRST_EN_TM_MSK UINT8_C(0x10)
#define BMM350_CP_COMP_CRST_EN_TM_POS UINT8_C(0x4)
#define BMM350_CP_COMP_VDD_EN_TM_MSK UINT8_C(0x20)
#define BMM350_CP_COMP_VDD_EN_TM_POS UINT8_C(0x5)
#define BMM350_CP_INTREFS_EN_TM_MSK UINT8_C(0x40)
#define BMM350_CP_INTREFS_EN_TM_POS UINT8_C(0x6)
#define BMM350_ADC_LOCAL_CHOP_EN_MSK UINT8_C(0x20)
#define BMM350_ADC_LOCAL_CHOP_EN_POS UINT8_C(0x5)
#define BMM350_INA_MODE_MSK UINT8_C(0x40)
#define BMM350_INA_MODE_POS UINT8_C(0x6)
#define BMM350_VDDD_EXT_EN_MSK UINT8_C(0x20)
#define BMM350_VDDD_EXT_EN_POS UINT8_C(0x5)
#define BMM350_VDDP_EXT_EN_MSK UINT8_C(0x80)
#define BMM350_VDDP_EXT_EN_POS UINT8_C(0x7)
#define BMM350_ADC_DSENS_EN_MSK UINT8_C(0x10)
#define BMM350_ADC_DSENS_EN_POS UINT8_C(0x4)
#define BMM350_DSENS_EN_MSK UINT8_C(0x20)
#define BMM350_DSENS_EN_POS UINT8_C(0x5)
#define BMM350_OTP_TM_CLVWR_EN_MSK UINT8_C(0x40)
#define BMM350_OTP_TM_CLVWR_EN_POS UINT8_C(0x6)
#define BMM350_OTP_VDDP_DIS_MSK UINT8_C(0x80)
#define BMM350_OTP_VDDP_DIS_POS UINT8_C(0x7)
#define BMM350_FORCE_HIGH_VREF_IREF_OK_MSK UINT8_C(0x10)
#define BMM350_FORCE_HIGH_VREF_IREF_OK_POS UINT8_C(0x4)
#define BMM350_FORCE_HIGH_FOSC_OK_MSK UINT8_C(0x20)
#define BMM350_FORCE_HIGH_FOSC_OK_POS UINT8_C(0x5)
#define BMM350_FORCE_HIGH_MFE_BG_RDY_MSK UINT8_C(0x40)
#define BMM350_FORCE_HIGH_MFE_BG_RDY_POS UINT8_C(0x6)
#define BMM350_FORCE_HIGH_MFE_VTMR_RDY_MSK UINT8_C(0x80)
#define BMM350_FORCE_HIGH_MFE_VTMR_RDY_POS UINT8_C(0x7)
#define BMM350_ERR_END_OF_RECHARGE_MSK UINT8_C(0x1)
#define BMM350_ERR_END_OF_RECHARGE_POS UINT8_C(0x0)
#define BMM350_ERR_END_OF_DISCHARGE_MSK UINT8_C(0x2)
#define BMM350_ERR_END_OF_DISCHARGE_POS UINT8_C(0x1)
#define BMM350_CP_TMX_DIGTP_SEL_MSK UINT8_C(0x7)
#define BMM350_CP_TMX_DIGTP_SEL_POS UINT8_C(0x0)
#define BMM350_CP_CPOSC_EN_TM_MSK UINT8_C(0x80)
#define BMM350_CP_CPOSC_EN_TM_POS UINT8_C(0x7)
#define BMM350_TST_ATM1_CFG_MSK UINT8_C(0x3f)
#define BMM350_TST_ATM1_CFG_POS UINT8_C(0x0)
#define BMM350_TST_TB1_EN_MSK UINT8_C(0x80)
#define BMM350_TST_TB1_EN_POS UINT8_C(0x7)
#define BMM350_TST_ATM2_CFG_MSK UINT8_C(0x1f)
#define BMM350_TST_ATM2_CFG_POS UINT8_C(0x0)
#define BMM350_TST_TB2_EN_MSK UINT8_C(0x80)
#define BMM350_TST_TB2_EN_POS UINT8_C(0x7)
#define BMM350_REG_DTB1X_SEL_MSK UINT8_C(0x7f)
#define BMM350_REG_DTB1X_SEL_POS UINT8_C(0x0)
#define BMM350_SEL_DTB1X_PAD_MSK UINT8_C(0x80)
#define BMM350_SEL_DTB1X_PAD_POS UINT8_C(0x7)
#define BMM350_REG_DTB2X_SEL_MSK UINT8_C(0x7f)
#define BMM350_REG_DTB2X_SEL_POS UINT8_C(0x0)
#define BMM350_TMR_TST_CFG_MSK UINT8_C(0x7f)
#define BMM350_TMR_TST_CFG_POS UINT8_C(0x0)
#define BMM350_TMR_TST_HIZ_VTMR_MSK UINT8_C(0x80)
#define BMM350_TMR_TST_HIZ_VTMR_POS UINT8_C(0x7)
/****************************** OTP MACROS ***************************/
#define BMM350_OTP_CMD_DIR_READ UINT8_C(0x20)
#define BMM350_OTP_CMD_DIR_PRGM_1B UINT8_C(0x40)
#define BMM350_OTP_CMD_DIR_PRGM UINT8_C(0x60)
#define BMM350_OTP_CMD_PWR_OFF_OTP UINT8_C(0x80)
#define BMM350_OTP_CMD_EXT_READ UINT8_C(0xA0)
#define BMM350_OTP_CMD_EXT_PRGM UINT8_C(0xE0)
#define BMM350_OTP_CMD_MSK UINT8_C(0xE0)
#define BMM350_OTP_WORD_ADDR_MSK UINT8_C(0x1F)
#define BMM350_OTP_STATUS_ERROR_MSK UINT8_C(0xE0)
#define BMM350_OTP_STATUS_ERROR(val) (val & BMM350_OTP_STATUS_ERROR_MSK)
#define BMM350_OTP_STATUS_NO_ERROR UINT8_C(0x00)
#define BMM350_OTP_STATUS_BOOT_ERR UINT8_C(0x20)
#define BMM350_OTP_STATUS_PAGE_RD_ERR UINT8_C(0x40)
#define BMM350_OTP_STATUS_PAGE_PRG_ERR UINT8_C(0x60)
#define BMM350_OTP_STATUS_SIGN_ERR UINT8_C(0x80)
#define BMM350_OTP_STATUS_INV_CMD_ERR UINT8_C(0xA0)
#define BMM350_OTP_STATUS_CMD_DONE UINT8_C(0x01)
/****************************** OTP indices ***************************/
#define BMM350_TEMP_OFF_SENS UINT8_C(0x0D)
#define BMM350_MAG_OFFSET_X UINT8_C(0x0E)
#define BMM350_MAG_OFFSET_Y UINT8_C(0x0F)
#define BMM350_MAG_OFFSET_Z UINT8_C(0x10)
#define BMM350_MAG_SENS_X UINT8_C(0x10)
#define BMM350_MAG_SENS_Y UINT8_C(0x11)
#define BMM350_MAG_SENS_Z UINT8_C(0x11)
#define BMM350_MAG_TCO_X UINT8_C(0x12)
#define BMM350_MAG_TCO_Y UINT8_C(0x13)
#define BMM350_MAG_TCO_Z UINT8_C(0x14)
#define BMM350_MAG_TCS_X UINT8_C(0x12)
#define BMM350_MAG_TCS_Y UINT8_C(0x13)
#define BMM350_MAG_TCS_Z UINT8_C(0x14)
#define BMM350_MAG_DUT_T_0 UINT8_C(0x18)
#define BMM350_CROSS_X_Y UINT8_C(0x15)
#define BMM350_CROSS_Y_X UINT8_C(0x15)
#define BMM350_CROSS_Z_X UINT8_C(0x16)
#define BMM350_CROSS_Z_Y UINT8_C(0x16)
#define BMM350_SENS_CORR_Y (0.01f)
#define BMM350_TCS_CORR_Z (0.0001f)
/**************************** Signed bit macros **********************/
#define BMM350_SIGNED_8_BIT UINT8_C(8)
#define BMM350_SIGNED_12_BIT UINT8_C(12)
#define BMM350_SIGNED_16_BIT UINT8_C(16)
#define BMM350_SIGNED_21_BIT UINT8_C(21)
#define BMM350_SIGNED_24_BIT UINT8_C(24)
/**************************** Self-test macros **********************/
#define BMM350_SELF_TEST_DISABLE UINT8_C(0x00)
#define BMM350_SELF_TEST_POS_X UINT8_C(0x0D)
#define BMM350_SELF_TEST_NEG_X UINT8_C(0x0B)
#define BMM350_SELF_TEST_POS_Y UINT8_C(0x15)
#define BMM350_SELF_TEST_NEG_Y UINT8_C(0x13)
#define BMM350_X_FM_XP_UST_MAX_LIMIT INT16_C(150)
#define BMM350_X_FM_XP_UST_MIN_LIMIT INT16_C(50)
#define BMM350_X_FM_XN_UST_MAX_LIMIT INT16_C(-50)
#define BMM350_X_FM_XN_UST_MIN_LIMIT INT16_C(-150)
#define BMM350_Y_FM_YP_UST_MAX_LIMIT INT16_C(150)
#define BMM350_Y_FM_YP_UST_MIN_LIMIT INT16_C(50)
#define BMM350_Y_FM_YN_UST_MAX_LIMIT INT16_C(-50)
#define BMM350_Y_FM_YN_UST_MIN_LIMIT INT16_C(-150)
/**************************** PMU command status 0 macros **********************/
#define BMM350_PMU_CMD_STATUS_0_SUS UINT8_C(0x00)
#define BMM350_PMU_CMD_STATUS_0_NM UINT8_C(0x01)
#define BMM350_PMU_CMD_STATUS_0_UPD_OAE UINT8_C(0x02)
#define BMM350_PMU_CMD_STATUS_0_FM UINT8_C(0x03)
#define BMM350_PMU_CMD_STATUS_0_FM_FAST UINT8_C(0x04)
#define BMM350_PMU_CMD_STATUS_0_FGR UINT8_C(0x05)
#define BMM350_PMU_CMD_STATUS_0_FGR_FAST UINT8_C(0x06)
#define BMM350_PMU_CMD_STATUS_0_BR UINT8_C(0x07)
#define BMM350_PMU_CMD_STATUS_0_BR_FAST UINT8_C(0x07)
/****************************** Enumerators ***************************/
enum bmm350_interrupt_enable_disable {
BMM350_DISABLE_INTERRUPT = BMM350_DISABLE,
BMM350_ENABLE_INTERRUPT = BMM350_ENABLE
};
enum bmm350_power_modes {
BMM350_SUSPEND_MODE = BMM350_PMU_CMD_SUS,
BMM350_NORMAL_MODE = BMM350_PMU_CMD_NM,
BMM350_FORCED_MODE = BMM350_PMU_CMD_FM,
BMM350_FORCED_MODE_FAST = BMM350_PMU_CMD_FM_FAST
};
enum bmm350_data_rates {
BMM350_DATA_RATE_400HZ = BMM350_ODR_400HZ,
BMM350_DATA_RATE_200HZ = BMM350_ODR_200HZ,
BMM350_DATA_RATE_100HZ = BMM350_ODR_100HZ,
BMM350_DATA_RATE_50HZ = BMM350_ODR_50HZ,
BMM350_DATA_RATE_25HZ = BMM350_ODR_25HZ,
BMM350_DATA_RATE_12_5HZ = BMM350_ODR_12_5HZ,
BMM350_DATA_RATE_6_25HZ = BMM350_ODR_6_25HZ,
BMM350_DATA_RATE_3_125HZ = BMM350_ODR_3_125HZ,
BMM350_DATA_RATE_1_5625HZ = BMM350_ODR_1_5625HZ
};
enum bmm350_magreset_type {
BMM350_FLUXGUIDE_9MS = BMM350_PMU_CMD_FGR,
BMM350_FLUXGUIDE_FAST = BMM350_PMU_CMD_FGR_FAST,
BMM350_BITRESET_9MS = BMM350_PMU_CMD_BR,
BMM350_BITRESET_FAST = BMM350_PMU_CMD_BR_FAST,
BMM350_NOMAGRESET = UINT8_C(127)
};
enum bmm350_intr_en_dis {
BMM350_INTR_DISABLE = BMM350_DISABLE,
BMM350_INTR_ENABLE = BMM350_ENABLE
};
enum bmm350_intr_map {
BMM350_UNMAP_FROM_PIN = BMM350_DISABLE,
BMM350_MAP_TO_PIN = BMM350_ENABLE
};
enum bmm350_intr_latch {
BMM350_PULSED = BMM350_INT_MODE_PULSED,
BMM350_LATCHED = BMM350_INT_MODE_LATCHED
};
enum bmm350_intr_polarity {
BMM350_ACTIVE_LOW = BMM350_INT_POL_ACTIVE_LOW,
BMM350_ACTIVE_HIGH = BMM350_INT_POL_ACTIVE_HIGH
};
enum bmm350_intr_drive {
BMM350_INTR_OPEN_DRAIN = BMM350_INT_OD_OPENDRAIN,
BMM350_INTR_PUSH_PULL = BMM350_INT_OD_PUSHPULL
};
enum bmm350_drdy_int_map_to_ibi {
BMM350_IBI_DISABLE = BMM350_DISABLE,
BMM350_IBI_ENABLE = BMM350_ENABLE
};
enum bmm350_clear_drdy_int_status_upon_ibi {
BMM350_NOCLEAR_ON_IBI = BMM350_DISABLE,
BMM350_CLEAR_ON_IBI = BMM350_ENABLE
};
enum bmm350_i2c_wdt_en {
BMM350_I2C_WDT_DIS = BMM350_DISABLE,
BMM350_I2C_WDT_EN = BMM350_ENABLE
};
enum bmm350_i2c_wdt_sel {
BMM350_I2C_WDT_SEL_SHORT = BMM350_DISABLE,
BMM350_I2C_WDT_SEL_LONG = BMM350_ENABLE
};
enum bmm350_performance_parameters {
BMM350_NO_AVERAGING = BMM350_AVG_NO_AVG,
BMM350_AVERAGING_2 = BMM350_AVG_2,
BMM350_AVERAGING_4 = BMM350_AVG_4,
BMM350_AVERAGING_8 = BMM350_AVG_8,
/*lint -e849*/
BMM350_ULTRALOWNOISE = BMM350_AVG_8,
BMM350_LOWNOISE = BMM350_AVG_4,
BMM350_REGULARPOWER = BMM350_AVG_2,
BMM350_LOWPOWER = BMM350_AVG_NO_AVG
};
enum bmm350_st_igen_en {
BMM350_ST_IGEN_DIS = BMM350_DISABLE,
BMM350_ST_IGEN_EN = BMM350_ENABLE
};
enum bmm350_st_n {
BMM350_ST_N_DIS = BMM350_DISABLE,
BMM350_ST_N_EN = BMM350_ENABLE
};
enum bmm350_st_p {
BMM350_ST_P_DIS = BMM350_DISABLE,
BMM350_ST_P_EN = BMM350_ENABLE
};
enum bmm350_ist_en_x {
BMM350_IST_X_DIS = BMM350_DISABLE,
BMM350_IST_X_EN = BMM350_ENABLE
};
enum bmm350_ist_en_y {
BMM350_IST_Y_DIS = BMM350_DISABLE,
BMM350_IST_Y_EN = BMM350_ENABLE
};
enum bmm350_ctrl_user {
BMM350_CFG_SENS_TIM_AON_DIS = BMM350_DISABLE,
BMM350_CFG_SENS_TIM_AON_EN = BMM350_ENABLE
};
enum bmm350_x_axis_en_dis {
BMM350_X_DIS = BMM350_DISABLE,
BMM350_X_EN = BMM350_ENABLE
};
enum bmm350_y_axis_en_dis {
BMM350_Y_DIS = BMM350_DISABLE,
BMM350_Y_EN = BMM350_ENABLE
};
enum bmm350_z_axis_en_dis {
BMM350_Z_DIS = BMM350_DISABLE,
BMM350_Z_EN = BMM350_ENABLE
};
/******************************************************************************/
/*! @name Function Pointers */
/******************************************************************************/
/*!
* @brief Bus communication function pointer which should be mapped to
* the platform specific read functions of the user
*
* @param[in] reg_addr : Register address from which data is read.
* @param[out] reg_data : Pointer to data buffer where read data is stored.
* @param[in] len : Number of bytes of data to be read.
* @param[in, out] intf_ptr : Void pointer that can enable the linking of descriptors
* for interface related call backs.
*
* retval = 0 -> Success
* retval < 0 -> Failure
*
*/
typedef BMM350_INTF_RET_TYPE (*bmm350_read_fptr_t)(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr);
/*!
* @brief Bus communication function pointer which should be mapped to
* the platform specific write functions of the user
*
* @param[in] reg_addr : Register address to which the data is written.
* @param[in] reg_data : Pointer to data buffer in which data to be written
* is stored.
* @param[in] len : Number of bytes of data to be written.
* @param[in, out] intf_ptr : Void pointer that can enable the linking of descriptors
* for interface related call backs
*
* retval = 0 -> Success
* retval < 0 -> Failure
*
*/
typedef BMM350_INTF_RET_TYPE (*bmm350_write_fptr_t)(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len,
void *intf_ptr);
/*!
* @brief Delay function pointer which should be mapped to
* delay function of the user
*
* @param[in] period : Delay in microseconds.
* @param[in, out] intf_ptr : Void pointer that can enable the linking of descriptors
* for interface related call backs
*
*/
typedef void (*bmm350_delay_us_fptr_t)(uint32_t period, void *intf_ptr);
/* Pre-declaration */
struct bmm350_dev;
/*!
* @brief Function pointer for the magnetic reset and wait override
*
* @param[in] dev : Structure instance of bmm350_dev.
* @return Result of API execution status
* @retval = 0 -> Success
* @retval < 0 -> Error
*/
typedef int8_t (*bmm350_mraw_override_t)(struct bmm350_dev *dev);
/************************* STRUCTURE DEFINITIONS *************************/
/*!
* @brief bmm350 un-compensated (raw) magnetometer data, signed integer
*/
struct bmm350_raw_mag_data
{
/*! Raw mag X data */
int32_t raw_xdata;
/*! Raw mag Y data */
int32_t raw_ydata;
/*! Raw mag Z data */
int32_t raw_zdata;
/*! Raw mag temperature value */
int32_t raw_data_t;
};
/*!
* @brief bmm350 compensated magnetometer data and temperature data
*/
struct bmm350_mag_temp_data
{
/*! Compensated mag X data */
float x;
/*! Compensated mag Y data */
float y;
/*! Compensated mag Z data */
float z;
/*! Temperature */
float temperature;
};
/*!
* @brief bmm350 magnetometer dut offset coefficient structure
*/
struct bmm350_dut_offset_coef
{
/*! Temperature offset */