forked from geekpm-emouse/BMA2x2_driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bma2x2.h
5848 lines (5681 loc) · 200 KB
/
bma2x2.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
/** \mainpage
*
****************************************************************************
* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
*
* File : bma2x2.h
*
* Date : 2016/11/14
*
* Revision : 2.0.7 $
*
* Usage: Sensor Driver file for BMA2x2 sensor
*
****************************************************************************
* \section Disclaimer
*
* Common:
* Bosch Sensortec products are developed for the consumer goods industry.
* They may only be used within the parameters of the respective valid
* product data sheet. Bosch Sensortec products are provided with the
* express understanding that there is no warranty of fitness for a
* particular purpose.They are not fit for use in life-sustaining,
* safety or security sensitive systems or any system or device
* that may lead to bodily harm or property damage if the system
* or device malfunctions. In addition,Bosch Sensortec products are
* not fit for use in products which interact with motor vehicle systems.
* The resale and or use of products are at the purchasers own risk and
* his own responsibility. The examination of fitness for the intended use
* is the sole responsibility of the Purchaser.
*
* The purchaser shall indemnify Bosch Sensortec from all third party
* claims, including any claims for incidental, or consequential damages,
* arising from any product use not covered by the parameters of
* the respective valid product data sheet or not approved by
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
* connection with such claims.
*
* The purchaser must monitor the market for the purchased products,
* particularly with regard to product safety and inform Bosch Sensortec
* without delay of all security relevant incidents.
*
* Engineering Samples are marked with an asterisk (*) or (e).
* Samples may vary from the valid technical specifications of the product
* series. They are therefore not intended or fit for resale to third
* parties or for use in end products. Their sole purpose is internal
* client testing. The testing of an engineering sample may in no way
* replace the testing of a product series. Bosch Sensortec assumes
* no liability for the use of engineering samples.
* By accepting the engineering samples, the Purchaser agrees to indemnify
* Bosch Sensortec from all claims arising from the use of engineering
* samples.
*
* Special:
* This software module (hereinafter called "Software") and any information
* on application-sheets (hereinafter called "Information") is provided
* free of charge for the sole purpose to support your application work.
* The Software and Information is subject to the following
* terms and conditions:
*
* The Software is specifically designed for the exclusive use for
* Bosch Sensortec products by personnel who have special experience
* and training. Do not use this Software if you do not have the
* proper experience or training.
*
* This Software package is provided `` as is `` and without any expressed
* or implied warranties,including without limitation, the implied warranties
* of merchantability and fitness for a particular purpose.
*
* Bosch Sensortec and their representatives and agents deny any liability
* for the functional impairment
* of this Software in terms of fitness, performance and safety.
* Bosch Sensortec and their representatives and agents shall not be liable
* for any direct or indirect damages or injury, except as
* otherwise stipulated in mandatory applicable law.
*
* The Information provided is believed to be accurate and reliable.
* Bosch Sensortec assumes no responsibility for the consequences of use
* of such Information nor for any infringement of patents or
* other rights of third parties which may result from its use.
* No license is granted by implication or otherwise under any patent or
* patent rights of Bosch. Specifications mentioned in the Information are
* subject to change without notice.
**************************************************************************/
/*! \file bma2x2.h
\brief BMA2x2 Sensor Driver Support Header File */
#ifndef __BMA2x2_H__
#define __BMA2x2_H__
/****************************************************************/
/**\name DATA TYPES INCLUDES */
/************************************************************/
/*!
* @brief The following definition uses for define the data types
*
* @note While porting the API please consider the following
* @note Please check the version of C standard
* @note Are you using Linux platform
*/
/*!
* @brief For the Linux platform support
* Please use the types.h for your data types definitions
*/
#ifdef __KERNEL__
#include <linux/types.h>
/* singed integer type*/
typedef int8_t s8;/**< used for signed 8bit */
typedef int16_t s16;/**< used for signed 16bit */
typedef int32_t s32;/**< used for signed 32bit */
typedef int64_t s64;/**< used for signed 64bit */
typedef u_int8_t u8;/**< used for unsigned 8bit */
typedef u_int16_t u16;/**< used for unsigned 16bit */
typedef u_int32_t u32;/**< used for unsigned 32bit */
typedef u_int64_t u64;/**< used for unsigned 64bit */
#else /* ! __KERNEL__ */
/**********************************************************
* These definition uses for define the C
* standard version data types
***********************************************************/
# if !defined(__STDC_VERSION__)
/************************************************
* compiler is C11 C standard
************************************************/
#if (__STDC_VERSION__ == 201112L)
/************************************************/
#include <stdint.h>
/************************************************/
/*unsigned integer types*/
typedef uint8_t u8;/**< used for unsigned 8bit */
typedef uint16_t u16;/**< used for unsigned 16bit */
typedef uint32_t u32;/**< used for unsigned 32bit */
typedef uint64_t u64;/**< used for unsigned 64bit */
/*signed integer types*/
typedef int8_t s8;/**< used for signed 8bit */
typedef int16_t s16;/**< used for signed 16bit */
typedef int32_t s32;/**< used for signed 32bit */
typedef int64_t s64;/**< used for signed 64bit */
/************************************************
* compiler is C99 C standard
************************************************/
#elif (__STDC_VERSION__ == 199901L)
/* stdint.h is a C99 supported c library.
which is used to fixed the integer size*/
/************************************************/
#include <stdint.h>
/************************************************/
/*unsigned integer types*/
typedef uint8_t u8;/**< used for unsigned 8bit */
typedef uint16_t u16;/**< used for unsigned 16bit */
typedef uint32_t u32;/**< used for unsigned 32bit */
typedef uint64_t u64;/**< used for unsigned 64bit */
/*signed integer types*/
typedef int8_t s8;/**< used for signed 8bit */
typedef int16_t s16;/**< used for signed 16bit */
typedef int32_t s32;/**< used for signed 32bit */
typedef int64_t s64;/**< used for signed 64bit */
/************************************************
* compiler is C89 or other C standard
************************************************/
#else /* !defined(__STDC_VERSION__) */
/*!
* @brief By default it is defined as 32 bit machine configuration
* define your data types based on your
* machine/compiler/controller configuration
*/
#define MACHINE_32_BIT
/*! @brief
* If your machine support 16 bit
* define the MACHINE_16_BIT
*/
#ifdef MACHINE_16_BIT
#include <limits.h>
/*signed integer types*/
typedef signed char s8;/**< used for signed 8bit */
typedef signed short int s16;/**< used for signed 16bit */
typedef signed long int s32;/**< used for signed 32bit */
#if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
typedef long int s64;/**< used for signed 64bit */
typedef unsigned long int u64;/**< used for unsigned 64bit */
#elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
typedef long long int s64;/**< used for signed 64bit */
typedef unsigned long long int u64;/**< used for unsigned 64bit */
#else
#warning Either the correct data type for signed 64 bit integer \
could not be found, or 64 bit integers are not supported in your environment.
#warning If 64 bit integers are supported on your platform, \
please set s64 manually.
#endif
/*unsigned integer types*/
typedef unsigned char u8;/**< used for unsigned 8bit */
typedef unsigned short int u16;/**< used for unsigned 16bit */
typedef unsigned long int u32;/**< used for unsigned 32bit */
/* If your machine support 32 bit
define the MACHINE_32_BIT*/
#elif defined MACHINE_32_BIT
/*signed integer types*/
typedef signed char s8;/**< used for signed 8bit */
typedef signed short int s16;/**< used for signed 16bit */
typedef signed int s32;/**< used for signed 32bit */
typedef signed long long int s64;/**< used for signed 64bit */
/*unsigned integer types*/
typedef unsigned char u8;/**< used for unsigned 8bit */
typedef unsigned short int u16;/**< used for unsigned 16bit */
typedef unsigned int u32;/**< used for unsigned 32bit */
typedef unsigned long long int u64;/**< used for unsigned 64bit */
/* If your machine support 64 bit
define the MACHINE_64_BIT*/
#elif defined MACHINE_64_BIT
/*signed integer types*/
typedef signed char s8;/**< used for signed 8bit */
typedef signed short int s16;/**< used for signed 16bit */
typedef signed int s32;/**< used for signed 32bit */
typedef signed long int s64;/**< used for signed 64bit */
/*unsigned integer types*/
typedef unsigned char u8;/**< used for unsigned 8bit */
typedef unsigned short int u16;/**< used for unsigned 16bit */
typedef unsigned int u32;/**< used for unsigned 32bit */
typedef unsigned long int u64;/**< used for unsigned 64bit */
#else
#warning The data types defined above which not supported \
define the data types manually
#endif
#endif
/*** This else will execute for the compilers
* which are not supported the C standards
* Like C89/C99/C11***/
#else
/*!
* @brief By default it is defined as 32 bit machine configuration
* define your data types based on your
* machine/compiler/controller configuration
*/
#define MACHINE_32_BIT
/* If your machine support 16 bit
define the MACHINE_16_BIT*/
#ifdef MACHINE_16_BIT
#include <limits.h>
/*signed integer types*/
typedef signed char s8;/**< used for signed 8bit */
typedef signed short int s16;/**< used for signed 16bit */
typedef signed long int s32;/**< used for signed 32bit */
#if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
typedef long int s64;/**< used for signed 64bit */
typedef unsigned long int u64;/**< used for unsigned 64bit */
#elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
typedef long long int s64;/**< used for signed 64bit */
typedef unsigned long long int u64;/**< used for unsigned 64bit */
#else
#warning Either the correct data type for signed 64 bit integer \
could not be found, or 64 bit integers are not supported in your environment.
#warning If 64 bit integers are supported on your platform, \
please set s64 manually.
#endif
/*unsigned integer types*/
typedef unsigned char u8;/**< used for unsigned 8bit */
typedef unsigned short int u16;/**< used for unsigned 16bit */
typedef unsigned long int u32;/**< used for unsigned 32bit */
/*! @brief If your machine support 32 bit
define the MACHINE_32_BIT*/
#elif defined MACHINE_32_BIT
/*signed integer types*/
typedef signed char s8;/**< used for signed 8bit */
typedef signed short int s16;/**< used for signed 16bit */
typedef signed int s32;/**< used for signed 32bit */
typedef signed long long int s64;/**< used for signed 64bit */
/*unsigned integer types*/
typedef unsigned char u8;/**< used for unsigned 8bit */
typedef unsigned short int u16;/**< used for unsigned 16bit */
typedef unsigned int u32;/**< used for unsigned 32bit */
typedef unsigned long long int u64;/**< used for unsigned 64bit */
/* If your machine support 64 bit
define the MACHINE_64_BIT*/
#elif defined MACHINE_64_BIT
/*signed integer types*/
typedef signed char s8;/**< used for signed 8bit */
typedef signed short int s16;/**< used for signed 16bit */
typedef signed int s32;/**< used for signed 32bit */
typedef signed long int s64;/**< used for signed 64bit */
/*unsigned integer types*/
typedef unsigned char u8;/**< used for unsigned 8bit */
typedef unsigned short int u16;/**< used for unsigned 16bit */
typedef unsigned int u32;/**< used for unsigned 32bit */
typedef unsigned long int u64;/**< used for unsigned 64bit */
#else
#warning The data types defined above which not supported \
define the data types manually
#endif
#endif
#endif
/***************************************************************/
/**\name BUS READ AND WRITE FUNCTION POINTERS */
/***************************************************************/
/*!
* @brief Define the calling convention of YOUR bus communication routine.
* @note This includes types of parameters.
* This example shows the configuration for an SPI bus link.
* If your communication function looks like this:
* write_my_bus_xy(u8 device_addr,
* u8 register_addr, u8 * data, u8 length);
* The BMA2x2_WR_FUNC_PTR would equal:
* BMA2x2_WR_FUNC_PTR char
* (* bus_write)(u8, u8, u8 *, u8)
* Parameters can be mixed as needed refer to
* the \ref BMA2x2_BUS_WRITE_FUNC macro.
*/
#define BMA2x2_WR_FUNC_PTR s8(*bus_write)\
(u8, u8, u8 *, u8)
/*!
* @brief link macro between API function calls and bus write function
* @note The bus write function can change since
* this is a system dependant issue.
* If the bus_write parameter calling order is like:
* reg_addr, reg_data, wr_len it would be as it is here.
* If the parameters are differently ordered or your communication function
* like I2C need to know the device address,
* you can change this macro accordingly.
* define BMA2x2_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
* bus_write(dev_addr, reg_addr, reg_data, wr_len)
* This macro lets all API functions call YOUR communication routine in
* a way that equals your definition in the
* ref BMA2x2_WR_FUNC_PTR definition.
*/
#define BMA2x2_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
bus_write(dev_addr, reg_addr, reg_data, wr_len)
/*!
* @brief Define the calling convention of YOUR bus communication routine.
* @note This includes types of parameters. This example
*shows the configuration for an SPI bus link.
*If your communication function looks like this:
*read_my_bus_xy(u8 device_addr,
*u8 register_addr, u8* data, u8 length);
*The BMA2x2_RD_FUNC_PTR would equal:
*BMA2x2_RD_FUNC_PTR s8
*(* bus_read)(u8, u8, u8*, u8)
*Parameters can be mixed as needed refer to the
ref BMA2x2_BUS_READ_FUNC macro.
*/
#define BMA2x2_SPI_RD_MASK 0x80
/* for spi read transactions on SPI the MSB has to be set */
#define BMA2x2_RD_FUNC_PTR s8(*bus_read)\
(u8, u8, u8 *, u8)
#define BMA2x2_BRD_FUNC_PTR s8(*burst_read)\
(u8, u8, u8 *, u32)
/*!
* @brief link macro between API function calls and bus read function
* @note The bus write function can change since
* this is a system dependant issue.
* If the bus_read parameter calling order is like:
* reg_addr, reg_data, wr_len it would be as it is here.
* If the parameters are differently ordered or your
* communication function like I2C need to know the device address,
* you can change this macro accordingly.
* define BMA2x2_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
* bus_read(dev_addr, reg_addr, reg_data, wr_len)
* This macro lets all API functions call YOUR
* communication routine in a way that equals your definition in the
* ref BMA2x2_WR_FUNC_PTR definition.
* @note: this macro also includes the "MSB='1'" for reading BMA2x2 addresses.
*/
#define BMA2x2_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, r_len)\
bus_read(dev_addr, reg_addr, reg_data, r_len)
#define BMA2x2_BURST_READ_FUNC(device_addr,\
register_addr, register_data, rd_len)\
burst_read(device_addr, register_addr, register_data, rd_len)
/**************************************************************/
/**\name I2C ADDRESS DEFINITIONS */
/**************************************************************/
/**< The following definition of I2C address is used for the following sensors
* BMA255
* BMA253
* BMA355
* BMA280
* BMA282
* BMA223
* BMA254
* BMA284
* BMA250E
* BMA222E
*/
#define BMA2x2_I2C_ADDR1 (0x18)
#define BMA2x2_I2C_ADDR2 (0x19)
/**< The following definition of I2C address is used for the following sensors
* BMC150
* BMC056
* BMC156
*/
#define BMA2x2_I2C_ADDR3 (0x10)
#define BMA2x2_I2C_ADDR4 (0x11)
/**************************************************************/
/**\name CONSTANTS DEFINITION */
/**************************************************************/
#define BMA2x2_INIT_VALUE ((u8)0)
#define BMA2x2_GEN_READ_WRITE_LENGTH ((u8)1)
#define BMA2x2_INTERFACE_IDLE_TIME_DELAY ((u8)1)
#define BMA2x2_LSB_MSB_READ_LENGTH ((u8)2)
/** BIT SHIFT DEFINITIONS */
#define BMA2x2_SHIFT_TWO_BITS ((u8)2)
#define BMA2x2_SHIFT_FOUR_BITS ((u8)4)
#define BMA2x2_SHIFT_FIVE_BITS ((u8)5)
#define BMA2x2_SHIFT_SIX_BITS ((u8)6)
#define BMA2x2_SHIFT_EIGHT_BITS ((u8)8)
/** FIFO DEFINITIONS */
#define BMA2x2_FIFO_MODE_STATUS_RANGE ((u8)2)
#define BMA2x2_FIFO_DATA_SELECT_RANGE ((u8)4)
#define BMA2x2_FIFO_MODE_RANGE ((u8)4)
#define BMA2x2_FIFO_WML_RANGE ((u8)32)
#define BMA2x2_FIFO_XYZ_DATA_ENABLED (0x00)
#define BMA2x2_FIFO_X_DATA_ENABLED (0x01)
#define BMA2x2_FIFO_Y_DATA_ENABLED (0x02)
#define BMA2x2_FIFO_Z_DATA_ENABLED (0x03)
#define BMA2x2_FIFO_DATA_ENABLED_MASK (0x03)
#define BMA2x2_FIFO_XYZ_AXES_FRAME_SIZE ((u8)6)
#define BMA2x2_FIFO_SINGLE_AXIS_FRAME_SIZE ((u8)2)
/** MODE RANGES */
#define BMA2x2_ACCEL_BW_MIN_RANGE ((u8)7)
#define BMA2x2_ACCEL_BW_1000HZ_RANGE ((u8)15)
#define BMA2x2_ACCEL_BW_MAX_RANGE ((u8)16)
#define BMA2x2_SLEEP_DURN_MIN_RANGE ((u8)4)
#define BMA2x2_SLEEP_TIMER_MODE_RANGE ((u8)2)
#define BMA2x2_SLEEP_DURN_MAX_RANGE ((u8)16)
#define BMA2x2_POWER_MODE_RANGE ((u8)6)
#define BMA2x2_SELF_TEST_AXIS_RANGE ((u8)4)
#define BMA2x2_SELF_TEST_SIGN_RANGE ((u8)2)
/**************************************************************/
/**\name ERROR CODE DEFINITIONS */
/**************************************************************/
#define E_OUT_OF_RANGE ((s8)-2)
#define E_BMA2x2_NULL_PTR ((s8)-127)
#define BMA2x2_NULL ((void *)0)
#define ERROR ((s8)-1)
#define SUCCESS ((u8)0)
/**************************************************************/
/**\name RETURN TYPE DEFINITION */
/**************************************************************/
#define BMA2x2_RETURN_FUNCTION_TYPE s8
/**< This refers BMA2x2 return type as char */
/**************************************************************/
/**\name REGISTER ADDRESS DEFINITIONS */
/**************************************************************/
#define BMA2x2_EEP_OFFSET (0x16)
#define BMA2x2_IMAGE_BASE (0x38)
#define BMA2x2_IMAGE_LEN (22)
#define BMA2x2_CHIP_ID_ADDR (0x00)
/** DATA ADDRESS DEFINITIONS */
#define BMA2x2_X_AXIS_LSB_ADDR (0x02)
#define BMA2x2_X_AXIS_MSB_ADDR (0x03)
#define BMA2x2_Y_AXIS_LSB_ADDR (0x04)
#define BMA2x2_Y_AXIS_MSB_ADDR (0x05)
#define BMA2x2_Z_AXIS_LSB_ADDR (0x06)
#define BMA2x2_Z_AXIS_MSB_ADDR (0x07)
#define BMA2x2_TEMP_ADDR (0x08)
/**STATUS ADDRESS DEFINITIONS */
#define BMA2x2_STAT1_ADDR (0x09)
#define BMA2x2_STAT2_ADDR (0x0A)
#define BMA2x2_STAT_TAP_SLOPE_ADDR (0x0B)
#define BMA2x2_STAT_ORIENT_HIGH_ADDR (0x0C)
#define BMA2x2_STAT_FIFO_ADDR (0x0E)
/**STATUS ADDRESS DEFINITIONS */
#define BMA2x2_RANGE_SELECT_ADDR (0x0F)
#define BMA2x2_BW_SELECT_ADDR (0x10)
#define BMA2x2_MODE_CTRL_ADDR (0x11)
#define BMA2x2_LOW_NOISE_CTRL_ADDR (0x12)
#define BMA2x2_DATA_CTRL_ADDR (0x13)
#define BMA2x2_RST_ADDR (0x14)
/**INTERUPT ADDRESS DEFINITIONS */
#define BMA2x2_INTR_ENABLE1_ADDR (0x16)
#define BMA2x2_INTR_ENABLE2_ADDR (0x17)
#define BMA2x2_INTR_SLOW_NO_MOTION_ADDR (0x18)
#define BMA2x2_INTR1_PAD_SELECT_ADDR (0x19)
#define BMA2x2_INTR_DATA_SELECT_ADDR (0x1A)
#define BMA2x2_INTR2_PAD_SELECT_ADDR (0x1B)
#define BMA2x2_INTR_SOURCE_ADDR (0x1E)
#define BMA2x2_INTR_SET_ADDR (0x20)
#define BMA2x2_INTR_CTRL_ADDR (0x21)
/** FEATURE ADDRESS DEFINITIONS */
#define BMA2x2_LOW_DURN_ADDR (0x22)
#define BMA2x2_LOW_THRES_ADDR (0x23)
#define BMA2x2_LOW_HIGH_HYST_ADDR (0x24)
#define BMA2x2_HIGH_DURN_ADDR (0x25)
#define BMA2x2_HIGH_THRES_ADDR (0x26)
#define BMA2x2_SLOPE_DURN_ADDR (0x27)
#define BMA2x2_SLOPE_THRES_ADDR (0x28)
#define BMA2x2_SLOW_NO_MOTION_THRES_ADDR (0x29)
#define BMA2x2_TAP_PARAM_ADDR (0x2A)
#define BMA2x2_TAP_THRES_ADDR (0x2B)
#define BMA2x2_ORIENT_PARAM_ADDR (0x2C)
#define BMA2x2_THETA_BLOCK_ADDR (0x2D)
#define BMA2x2_THETA_FLAT_ADDR (0x2E)
#define BMA2x2_FLAT_HOLD_TIME_ADDR (0x2F)
#define BMA2x2_SELFTEST_ADDR (0x32)
#define BMA2x2_EEPROM_CTRL_ADDR (0x33)
#define BMA2x2_SERIAL_CTRL_ADDR (0x34)
/**OFFSET ADDRESS DEFINITIONS */
#define BMA2x2_OFFSET_CTRL_ADDR (0x36)
#define BMA2x2_OFFSET_PARAMS_ADDR (0x37)
#define BMA2x2_OFFSET_X_AXIS_ADDR (0x38)
#define BMA2x2_OFFSET_Y_AXIS_ADDR (0x39)
#define BMA2x2_OFFSET_Z_AXIS_ADDR (0x3A)
/**GP ADDRESS DEFINITIONS */
#define BMA2x2_GP0_ADDR (0x3B)
#define BMA2x2_GP1_ADDR (0x3C)
/**FIFO ADDRESS DEFINITIONS */
#define BMA2x2_FIFO_MODE_ADDR (0x3E)
#define BMA2x2_FIFO_DATA_OUTPUT_ADDR (0x3F)
#define BMA2x2_FIFO_WML_TRIG (0x30)
/**************************************************************/
/**\name ACCEL RESOLUTION DEFINITION */
/**************************************************************/
#define BMA2x2_12_RESOLUTION (0)
#define BMA2x2_10_RESOLUTION (1)
#define BMA2x2_14_RESOLUTION (2)
/**************************************************************/
/**\name ACCEL DELAY DEFINITION */
/**************************************************************/
/* register write and read delays */
#define BMA2x2_MDELAY_DATA_TYPE u32
#define BMA2x2_EE_W_DELAY (28)
/**************************************************************/
/**\name STRUCTURE DEFINITIONS */
/**************************************************************/
/*!
* @brief read accel xyz data for 10,14 and 12 bit resolution
*/
struct bma2x2_accel_data {
s16 x,/**< accel x data 10,14 and 12 resolution*/
y,/**< accel y data 10,14 and 12 resolution*/
z;/**< accel z data 10,14 and 12 resolution*/
};
/*!
* @brief read accel xyz data for 10,14 and 12 bit resolution
* and temperature output
*/
struct bma2x2_accel_data_temp {
s16 x,/**< accel x data 10,14 and 12 resolution*/
y,/**< accel y data 10,14 and 12 resolution*/
z;/**< accel z data 10,14 and 12 resolution*/
s8 temp;/**< accel temperature data*/
};
/*!
* @brief read accel xyz data for 8 bit resolution
*/
struct bma2x2_accel_eight_resolution {
s8 x,/**< accel x data with eight bit resolution*/
y,/**< accel y data with eight bit resolution*/
z;/**< accel z data with eight bit resolution*/
};
/*!
* @brief read accel xyz data for 8 bit resolution and temperature
*/
struct bma2x2_accel_eight_resolution_temp {
s8 x,/**< accel x data with eight bit resolution*/
y,/**< accel y data with eight bit resolution*/
z;/**< accel z data with eight bit resolution*/
s8 temp;/**< accel temperature data*/
};
/*!
* @brief FIFO data read is parsed and returned to user using this union.
*
* @note Read the respective data fields in the union for corresponding
* accel data axes enabled in FIFO storage( Axes stored in FIFO can be set
* by the data_select_bits in the register FIFO_CONFIG_1 )
*
* data enabled for FIFO storage | Data field to be read from the below union
* ------------------------------|-------------------------------------------
* XYZ axes enabled | struct bma2x2_accel_data
* X axis data enabled | x data
* Y axis data enabled | y data
* Z axis data enabled | z data
*/
union fifo_frame {
/*! FIFO data stored here when XYZ data enabled in
fifo_data_select bits of register 0x3E*/
struct bma2x2_accel_data accel_data;
/*! FIFO data stored here when accel X data enabled in
fifo_data_select bits of register 0x3E*/
s16 x;
/*! FIFO data stored here when accel Y data enabled in
fifo_data_select bits of register 0x3E*/
s16 y;
/*! FIFO data stored here when accel Z data enabled in
fifo_data_select bits of register 0x3E*/
s16 z;
};
/*!
* @brief bma2x2 initialization struct
* struct bma2x2_t is used for assigning the following parameters.
*
* Bus write function pointer: BMA2x2_WR_FUNC_PTR
* Bus read function pointer: BMA2x2_RD_FUNC_PTR
* Burst read function pointer: BMA2x2_BRD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
* Chip id of the sensor: chip_id
*/
struct bma2x2_t {
/*! save current bma2x2 operation mode */
u8 power_mode_u8;
/*! chip_id of bma2x2 */
u8 chip_id;
/*! the value of power mode register 0x11*/
u8 ctrl_mode_reg;
/*! the value of power mode register 0x12*/
u8 low_mode_reg;
/*! initializes bma2x2's I2C device address*/
u8 dev_addr;
/*! store the fifo configuration register*/
u8 fifo_config;
/*! function pointer to the SPI/I2C write function */
BMA2x2_WR_FUNC_PTR;
/*! function pointer to the SPI/I2C read function */
BMA2x2_RD_FUNC_PTR;
/*! function pointer to the SPI/I2C burst read function */
BMA2x2_BRD_FUNC_PTR;
/*! delay(in ms) function pointer */
void (*delay_msec)(BMA2x2_MDELAY_DATA_TYPE);
};
/*!
* @brief FIFO configurations are stored in this structure
*
* @note User should map the following before reading the FIFO data
* - buffer for storing the FIFO data should be mapped to the member
* "fifo_data" of this structure
* - Number of bytes to be read from the FIFO should be mapped to the member
* "fifo_length" of this structure
*/
struct fifo_configuration {
/*! Data buffer of user defined length is to be mapped here */
u8 *fifo_data;
/*! Index of accel data stored in FIFO buffer */
u8 accel_byte_start_index;
/*! No of bytes to be read in FIFO as specified by the user */
u8 fifo_length;
};
/*********************************************************************/
/**\name REGISTER BIT MASK, BIT LENGTH, BIT POSITION DEFINITIONS */
/********************************************************************/
/******************************/
/**\name CHIP ID */
/******************************/
#define BMA2x2_CHIP_ID_POS (0)
#define BMA2x2_CHIP_ID_MSK (0xFF)
#define BMA2x2_CHIP_ID_LEN (8)
#define BMA2x2_CHIP_ID_REG BMA2x2_CHIP_ID_ADDR
/******************************/
/**\name DATA REGISTER-X */
/******************************/
#define BMA2x2_NEW_DATA_X_POS (0)
#define BMA2x2_NEW_DATA_X_LEN (1)
#define BMA2x2_NEW_DATA_X_MSK (0x01)
#define BMA2x2_NEW_DATA_X_REG BMA2x2_X_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_X14_LSB_POS (2)
#define BMA2x2_ACCEL_X14_LSB_LEN (6)
#define BMA2x2_ACCEL_X14_LSB_MSK (0xFC)
#define BMA2x2_ACCEL_X14_LSB_REG BMA2x2_X_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_X12_LSB_POS (4)
#define BMA2x2_ACCEL_X12_LSB_LEN (4)
#define BMA2x2_ACCEL_X12_LSB_MSK (0xF0)
#define BMA2x2_ACCEL_X12_LSB_REG BMA2x2_X_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_X10_LSB_POS (6)
#define BMA2x2_ACCEL_X10_LSB_LEN (2)
#define BMA2x2_ACCEL_X10_LSB_MSK (0xC0)
#define BMA2x2_ACCEL_X10_LSB_REG BMA2x2_X_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_X8_LSB_POS (0)
#define BMA2x2_ACCEL_X8_LSB_LEN (0)
#define BMA2x2_ACCEL_X8_LSB_MSK (0x00)
#define BMA2x2_ACCEL_X8_LSB_REG BMA2x2_X_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_X_MSB_POS (0)
#define BMA2x2_ACCEL_X_MSB_LEN (8)
#define BMA2x2_ACCEL_X_MSB_MSK (0xFF)
#define BMA2x2_ACCEL_X_MSB_REG BMA2x2_X_AXIS_MSB_ADDR
/******************************/
/**\name DATA REGISTER-Y */
/******************************/
#define BMA2x2_NEW_DATA_Y_POS (0)
#define BMA2x2_NEW_DATA_Y_LEN (1)
#define BMA2x2_NEW_DATA_Y_MSK (0x01)
#define BMA2x2_NEW_DATA_Y_REG BMA2x2_Y_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Y14_LSB_POS (2)
#define BMA2x2_ACCEL_Y14_LSB_LEN (6)
#define BMA2x2_ACCEL_Y14_LSB_MSK (0xFC)
#define BMA2x2_ACCEL_Y14_LSB_REG BMA2x2_Y_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Y12_LSB_POS (4)
#define BMA2x2_ACCEL_Y12_LSB_LEN (4)
#define BMA2x2_ACCEL_Y12_LSB_MSK (0xF0)
#define BMA2x2_ACCEL_Y12_LSB_REG BMA2x2_Y_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Y10_LSB_POS (6)
#define BMA2x2_ACCEL_Y10_LSB_LEN (2)
#define BMA2x2_ACCEL_Y10_LSB_MSK (0xC0)
#define BMA2x2_ACCEL_Y10_LSB_REG BMA2x2_Y_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Y8_LSB_POS (0)
#define BMA2x2_ACCEL_Y8_LSB_LEN (0)
#define BMA2x2_ACCEL_Y8_LSB_MSK (0x00)
#define BMA2x2_ACCEL_Y8_LSB_REG BMA2x2_Y_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Y_MSB_POS (0)
#define BMA2x2_ACCEL_Y_MSB_LEN (8)
#define BMA2x2_ACCEL_Y_MSB_MSK (0xFF)
#define BMA2x2_ACCEL_Y_MSB_REG BMA2x2_Y_AXIS_MSB_ADDR
/******************************/
/**\name DATA REGISTER-Z */
/******************************/
#define BMA2x2_NEW_DATA_Z_POS (0)
#define BMA2x2_NEW_DATA_Z_LEN (1)
#define BMA2x2_NEW_DATA_Z_MSK (0x01)
#define BMA2x2_NEW_DATA_Z_REG BMA2x2_Z_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Z14_LSB_POS (2)
#define BMA2x2_ACCEL_Z14_LSB_LEN (6)
#define BMA2x2_ACCEL_Z14_LSB_MSK (0xFC)
#define BMA2x2_ACCEL_Z14_LSB_REG BMA2x2_Z_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Z12_LSB_POS (4)
#define BMA2x2_ACCEL_Z12_LSB_LEN (4)
#define BMA2x2_ACCEL_Z12_LSB_MSK (0xF0)
#define BMA2x2_ACCEL_Z12_LSB_REG BMA2x2_Z_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Z10_LSB_POS (6)
#define BMA2x2_ACCEL_Z10_LSB_LEN (2)
#define BMA2x2_ACCEL_Z10_LSB_MSK (0xC0)
#define BMA2x2_ACCEL_Z10_LSB_REG BMA2x2_Z_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Z8_LSB_POS (0)
#define BMA2x2_ACCEL_Z8_LSB_LEN (0)
#define BMA2x2_ACCEL_Z8_LSB_MSK (0x00)
#define BMA2x2_ACCEL_Z8_LSB_REG BMA2x2_Z_AXIS_LSB_ADDR
#define BMA2x2_ACCEL_Z_MSB_POS (0)
#define BMA2x2_ACCEL_Z_MSB_LEN (8)
#define BMA2x2_ACCEL_Z_MSB_MSK (0xFF)
#define BMA2x2_ACCEL_Z_MSB_REG BMA2x2_Z_AXIS_MSB_ADDR
/******************************/
/**\name TEMPERATURE */
/******************************/
#define BMA2x2_ACCEL_TEMP_MSB_POS (0)
#define BMA2x2_ACCEL_TEMP_MSB_LEN (8)
#define BMA2x2_ACCEL_TEMP_MSB_MSK (0xFF)
#define BMA2x2_ACCEL_TEMP_MSB_REG BMA2x2_TEMPERATURE_REG
/***************************************/
/**\name INTERRUPT STATUS OF LOW-G */
/**************************************/
#define BMA2x2_LOW_G_INTR_STAT_POS (0)
#define BMA2x2_LOW_G_INTR_STAT_LEN (1)
#define BMA2x2_LOW_G_INTR_STAT_MSK (0x01)
#define BMA2x2_LOW_G_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF HIGH-G */
/**************************************/
#define BMA2x2_HIGH_G_INTR_STAT_POS (1)
#define BMA2x2_HIGH_G_INTR_STAT_LEN (1)
#define BMA2x2_HIGH_G_INTR_STAT_MSK (0x02)
#define BMA2x2_HIGH_G_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF SLOPE */
/**************************************/
#define BMA2x2_SLOPE_INTR_STAT_POS (2)
#define BMA2x2_SLOPE_INTR_STAT_LEN (1)
#define BMA2x2_SLOPE_INTR_STAT_MSK (0x04)
#define BMA2x2_SLOPE_INTR_STAT_REG BMA2x2_STAT1_ADDR
/*******************************************/
/**\name INTERRUPT STATUS OF SLOW NO MOTION*/
/*******************************************/
#define BMA2x2_SLOW_NO_MOTION_INTR_STAT_POS (3)
#define BMA2x2_SLOW_NO_MOTION_INTR_STAT_LEN (1)
#define BMA2x2_SLOW_NO_MOTION_INTR_STAT_MSK (0x08)
#define BMA2x2_SLOW_NO_MOTION_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF DOUBLE TAP */
/**************************************/
#define BMA2x2_DOUBLE_TAP_INTR_STAT_POS (4)
#define BMA2x2_DOUBLE_TAP_INTR_STAT_LEN (1)
#define BMA2x2_DOUBLE_TAP_INTR_STAT_MSK (0x10)
#define BMA2x2_DOUBLE_TAP_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF SINGLE TAP */
/**************************************/
#define BMA2x2_SINGLE_TAP_INTR_STAT_POS (5)
#define BMA2x2_SINGLE_TAP_INTR_STAT_LEN (1)
#define BMA2x2_SINGLE_TAP_INTR_STAT_MSK (0x20)
#define BMA2x2_SINGLE_TAP_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF ORIENT*/
/**************************************/
#define BMA2x2_ORIENT_INTR_STAT_POS (6)
#define BMA2x2_ORIENT_INTR_STAT_LEN (1)
#define BMA2x2_ORIENT_INTR_STAT_MSK (0x40)
#define BMA2x2_ORIENT_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF FLAT */
/**************************************/
#define BMA2x2_FLAT_INTR_STAT_POS (7)
#define BMA2x2_FLAT_INTR_STAT_LEN (1)
#define BMA2x2_FLAT_INTR_STAT_MSK (0x80)
#define BMA2x2_FLAT_INTR_STAT_REG BMA2x2_STAT1_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF FIFO FULL */
/**************************************/
#define BMA2x2_FIFO_FULL_INTR_STAT_POS (5)
#define BMA2x2_FIFO_FULL_INTR_STAT_LEN (1)
#define BMA2x2_FIFO_FULL_INTR_STAT_MSK (0x20)
#define BMA2x2_FIFO_FULL_INTR_STAT_REG BMA2x2_STAT2_ADDR
/*******************************************/
/**\name INTERRUPT STATUS OF FIFO WATERMARK*/
/******************************************/
#define BMA2x2_FIFO_WM_INTR_STAT_POS (6)
#define BMA2x2_FIFO_WM_INTR_STAT_LEN (1)
#define BMA2x2_FIFO_WM_INTR_STAT_MSK (0x40)
#define BMA2x2_FIFO_WM_INTR_STAT_REG BMA2x2_STAT2_ADDR
/***************************************/
/**\name INTERRUPT STATUS OF DATA */
/**************************************/
#define BMA2x2_DATA_INTR_STAT_POS (7)
#define BMA2x2_DATA_INTR_STAT_LEN (1)
#define BMA2x2_DATA_INTR_STAT_MSK (0x80)
#define BMA2x2_DATA_INTR_STAT_REG BMA2x2_STAT2_ADDR
/*********************************************/
/**\name INTERRUPT STATUS SLOPE XYZ AND SIGN */
/*********************************************/
#define BMA2x2_SLOPE_FIRST_X_POS (0)
#define BMA2x2_SLOPE_FIRST_X_LEN (1)
#define BMA2x2_SLOPE_FIRST_X_MSK (0x01)
#define BMA2x2_SLOPE_FIRST_X_REG BMA2x2_STAT_TAP_SLOPE_ADDR
#define BMA2x2_SLOPE_FIRST_Y_POS (1)
#define BMA2x2_SLOPE_FIRST_Y_LEN (1)
#define BMA2x2_SLOPE_FIRST_Y_MSK (0x02)
#define BMA2x2_SLOPE_FIRST_Y_REG BMA2x2_STAT_TAP_SLOPE_ADDR
#define BMA2x2_SLOPE_FIRST_Z_POS (2)
#define BMA2x2_SLOPE_FIRST_Z_LEN (1)
#define BMA2x2_SLOPE_FIRST_Z_MSK (0x04)
#define BMA2x2_SLOPE_FIRST_Z_REG BMA2x2_STAT_TAP_SLOPE_ADDR
#define BMA2x2_SLOPE_SIGN_STAT_POS (3)
#define BMA2x2_SLOPE_SIGN_STAT_LEN (1)
#define BMA2x2_SLOPE_SIGN_STAT_MSK (0x08)
#define BMA2x2_SLOPE_SIGN_STAT_REG BMA2x2_STAT_TAP_SLOPE_ADDR
/*********************************************/
/**\name INTERRUPT STATUS TAP XYZ AND SIGN */
/*********************************************/
#define BMA2x2_TAP_FIRST_X_POS (4)
#define BMA2x2_TAP_FIRST_X_LEN (1)
#define BMA2x2_TAP_FIRST_X_MSK (0x10)
#define BMA2x2_TAP_FIRST_X_REG BMA2x2_STAT_TAP_SLOPE_ADDR
#define BMA2x2_TAP_FIRST_Y_POS (5)
#define BMA2x2_TAP_FIRST_Y_LEN (1)
#define BMA2x2_TAP_FIRST_Y_MSK (0x20)
#define BMA2x2_TAP_FIRST_Y_REG BMA2x2_STAT_TAP_SLOPE_ADDR
#define BMA2x2_TAP_FIRST_Z_POS (6)
#define BMA2x2_TAP_FIRST_Z_LEN (1)
#define BMA2x2_TAP_FIRST_Z_MSK (0x40)
#define BMA2x2_TAP_FIRST_Z_REG BMA2x2_STAT_TAP_SLOPE_ADDR
#define BMA2x2_TAP_SIGN_STAT_POS (7)
#define BMA2x2_TAP_SIGN_STAT_LEN (1)
#define BMA2x2_TAP_SIGN_STAT_MSK (0x80)
#define BMA2x2_TAP_SIGN_STAT_REG BMA2x2_STAT_TAP_SLOPE_ADDR
/*********************************************/
/**\name INTERRUPT STATUS HIGH_G XYZ AND SIGN */
/*********************************************/
#define BMA2x2_HIGH_G_FIRST_X_POS (0)
#define BMA2x2_HIGH_G_FIRST_X_LEN (1)
#define BMA2x2_HIGH_G_FIRST_X_MSK (0x01)
#define BMA2x2_HIGH_G_FIRST_X_REG BMA2x2_STAT_ORIENT_HIGH_ADDR
#define BMA2x2_HIGH_G_FIRST_Y_POS (1)
#define BMA2x2_HIGH_G_FIRST_Y_LEN (1)
#define BMA2x2_HIGH_G_FIRST_Y_MSK (0x02)
#define BMA2x2_HIGH_G_FIRST_Y_REG BMA2x2_STAT_ORIENT_HIGH_ADDR
#define BMA2x2_HIGH_G_FIRST_Z_POS (2)
#define BMA2x2_HIGH_G_FIRST_Z_LEN (1)
#define BMA2x2_HIGH_G_FIRST_Z_MSK (0x04)
#define BMA2x2_HIGH_G_FIRST_Z_REG BMA2x2_STAT_ORIENT_HIGH_ADDR
#define BMA2x2_HIGH_G_SIGN_STAT_POS (3)
#define BMA2x2_HIGH_G_SIGN_STAT_LEN (1)
#define BMA2x2_HIGH_G_SIGN_STAT_MSK (0x08)
#define BMA2x2_HIGH_G_SIGN_STAT_REG BMA2x2_STAT_ORIENT_HIGH_ADDR
/*********************************************/
/**\name INTERRUPT STATUS ORIENT */
/*********************************************/
#define BMA2x2_ORIENT_STAT_POS (4)
#define BMA2x2_ORIENT_STAT_LEN (3)
#define BMA2x2_ORIENT_STAT_MSK (0x70)
#define BMA2x2_ORIENT_STAT_REG BMA2x2_STAT_ORIENT_HIGH_ADDR
/*********************************************/
/**\name INTERRUPT STATUS FLAT */
/*********************************************/
#define BMA2x2_FLAT_STAT_POS (7)
#define BMA2x2_FLAT_STAT_LEN (1)
#define BMA2x2_FLAT_STAT_MSK (0x80)
#define BMA2x2_FLAT_STAT_REG BMA2x2_STAT_ORIENT_HIGH_ADDR
/*********************************************/
/**\name INTERRUPT STATUS OF FIFO FRAME COUNT */
/*********************************************/
#define BMA2x2_FIFO_FRAME_COUNT_STAT_POS (0)
#define BMA2x2_FIFO_FRAME_COUNT_STAT_LEN (7)
#define BMA2x2_FIFO_FRAME_COUNT_STAT_MSK (0x7F)
#define BMA2x2_FIFO_FRAME_COUNT_STAT_REG BMA2x2_STAT_FIFO_ADDR
/*********************************************/
/**\name INTERRUPT STATUS OF FIFO OVERRUN */
/*********************************************/
#define BMA2x2_FIFO_OVERRUN_STAT_POS (7)
#define BMA2x2_FIFO_OVERRUN_STAT_LEN (1)
#define BMA2x2_FIFO_OVERRUN_STAT_MSK (0x80)
#define BMA2x2_FIFO_OVERRUN_STAT_REG BMA2x2_STAT_FIFO_ADDR
/****************************/
/**\name RANGE */
/****************************/
#define BMA2x2_RANGE_SELECT_POS (0)
#define BMA2x2_RANGE_SELECT_LEN (4)