1 /*
2  * Copyright (c) 2015 Eric Holland
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #ifndef __SENSOR_BMI055_H
9 #define __SENSOR_BMI055_H
10 
11 #include <sys/types.h>
12 
13 #define BMI055_ADDRESS_READ(x) (x | 0x80)
14 #define BMI055_ADDERSS_WRITE(x) (x & 0x7F)
15 
16 /**
17 *       definitions for accelerometer IC
18 */
19 #define BMI055_ACC_BGW_CHPID        0x00
20 #define BMI055_ACC_ACCD_X_LSB       0X02
21 #define BMI055_ACC_ACCD_X_MSB       0X03
22 #define BMI055_ACC_ACCD_Y_LSB       0X04
23 #define BMI055_ACC_ACCD_Y_MSB       0X05
24 #define BMI055_ACC_ACCD_Z_LSB       0X06
25 #define BMI055_ACC_ACCD_Z_MSB       0X07
26 #define BMI055_ACC_ACCD_TEMP        0X08
27 #define BMI055_ACC_INT_STATUS_0     0X09
28 #define BMI055_ACC_INT_STATUS_1     0X0a
29 #define BMI055_ACC_INT_STATUS_2     0x0b
30 #define BMI055_ACC_INT_STATUS_3     0x0c
31 #define BMI055_ACC_FIFO_STATUS      0x0e
32 #define BMI055_ACC_PMU_RANGE        0x0f
33 #define BMI055_ACC_PMU_BW           0x10
34 #define BMI055_ACC_PMU_LPW          0x11
35 #define BMI055_ACC_PMU_LOW_POWER    0x12
36 #define BMI055_ACC_ACCD_HBW         0x13
37 #define BMI055_ACC_BGW_SOFTRESET    0x14
38 #define BMI055_ACC_INT_EN_0         0x16
39 #define BMI055_ACC_INT_EN_1         0x17
40 #define BMI055_ACC_INT_EN_2         0x18
41 #define BMI055_ACC_INT_MAP_0        0x19
42 #define BMI055_ACC_INT_MAP_1        0x1A
43 #define BMI055_ACC_INT_MAP_2        0x1B
44 #define BMI055_ACC_INT_SRC          0x1E
45 #define BMI055_ACC_INT_OUT_CTRL     0x20
46 #define BMI055_ACC_INT_RST_LATCH    0x21
47 #define BMI055_ACC_INT_0            0x22
48 #define BMI055_ACC_INT_1            0x23
49 #define BMI055_ACC_INT_2            0x24
50 #define BMI055_ACC_INT_3            0x25
51 #define BMI055_ACC_INT_4            0x26
52 #define BMI055_ACC_INT_5            0x27
53 #define BMI055_ACC_INT_6            0x28
54 #define BMI055_ACC_INT_7            0x29
55 #define BMI055_ACC_INT_8            0x2a
56 #define BMI055_ACC_INT_9            0x2b
57 #define BMI055_ACC_INT_A            0x2c
58 #define BMI055_ACC_INT_B            0x2d
59 #define BMI055_ACC_INT_C            0x2e
60 #define BMI055_ACC_INT_D            0x2f
61 #define BMI055_ACC_FIFO_CONFIG_0    0x30
62 #define BMI055_ACC_PMU_SELF_TEST    0x32
63 #define BMI055_ACC_TRIM_NVM_CTRL    0x33
64 #define BMI055_ACC_BGW_SPI3_WDT     0x34
65 #define BMI055_ACC_OFC_CTRL         0x36
66 #define BMI055_ACC_OFC_SETTING      0x37
67 #define BMI055_ACC_OFC_OFFSET_X     0x38
68 #define BMI055_ACC_OFC_OFFSET_Y     0x39
69 #define BMI055_ACC_OFC_OFFSET_Z     0x3A
70 #define BMI055_ACC_TRIM_GP0         0x3B
71 #define BMI055_ACC_TRIM_GP1         0x3C
72 #define BMI055_ACC_FIFO_CONFIG_1    0x3E
73 #define BMI055_ACC_FIFO_DATA        0x3F
74 
75 
76 /**
77 *       definitions for gyro IC
78 */
79 #define BMI055_GYRO_CHIP_ID          0x00
80 #define BMI055_GYRO_RATE_X_LSB       0X02
81 #define BMI055_GYRO_RATE_X_MSB       0X03
82 #define BMI055_GYRO_RATE_Y_LSB       0X04
83 #define BMI055_GYRO_RATE_Y_MSB       0X05
84 #define BMI055_GYRO_RATE_Z_LSB       0X06
85 #define BMI055_GYRO_RATE_Z_MSB       0X07
86 #define BMI055_GYRO_INT_STATUS_0     0X09
87 #define BMI055_GYRO_INT_STATUS_1     0X0a
88 #define BMI055_GYRO_INT_STATUS_2     0x0b
89 #define BMI055_GYRO_INT_STATUS_3     0x0c
90 #define BMI055_GYRO_FIFO_STATUS      0x0e
91 #define BMI055_GYRO_RANGE            0x0f
92 #define BMI055_GYRO_BW               0x10
93 #define BMI055_GYRO_LPM1             0x11
94 #define BMI055_GYRO_LPM2             0x12
95 #define BMI055_GYRO_RATE_HBW         0x13
96 #define BMI055_GYRO_BGW_SOFTRESET    0x14
97 #define BMI055_GYRO_INT_EN_0         0x15
98 #define BMI055_GYRO_INT_EN_1         0x16
99 #define BMI055_GYRO_INT_MAP_0        0x17
100 #define BMI055_GYRO_INT_MAP_1        0x18
101 #define BMI055_GYRO_INT_MAP_2        0x19
102 #define BMI055_GYRO_0X1A             0x1A
103 #define BMI055_GYRO_0X1B             0x1B
104 #define BMI055_GYRO_0X1C             0x1C
105 #define BMI055_GYRO_0X1E             0x1E
106 #define BMI055_GYRO_INT_RST_LATCH    0x21
107 #define BMI055_GYRO_HIGH_TH_X        0x22
108 #define BMI055_GYRO_HIGH_DUR_X       0x23
109 #define BMI055_GYRO_HIGH_TH_Y        0x24
110 #define BMI055_GYRO_HIGH_DUR_Y       0x25
111 #define BMI055_GYRO_HIGH_TH_Z        0x26
112 #define BMI055_GYRO_HIGH_DUR_Z       0x27
113 #define BMI055_GYRO_SOC              0x31
114 #define BMI055_GYRO_A_FOC            0x32
115 #define BMI055_GYRO_TRIM_NVM_CTRL    0x33
116 #define BMI055_GYRO_BGW_SPI3_WDT     0x34
117 #define BMI055_GYRO_OFC1             0x36
118 #define BMI055_GYRO_OFC2             0x37
119 #define BMI055_GYRO_OFC3             0x38
120 #define BMI055_GYRO_OFC4             0x39
121 #define BMI055_GYRO_TRIM_GP0         0x3A
122 #define BMI055_GYRO_TRIM_GP1         0x3B
123 #define BMI055_GYRO_BIST             0x3C
124 #define BMI055_GYRO_FIFO_CONFIG_0    0x3D
125 #define BMI055_GYRO_FIFO_CONFIG_1    0x3E
126 
127 
128 
129 
130 
131 
132 
133 
134 #endif
135 
136