BlueNinja BSP  0.5
Cerevo BlueNinja(CDP-TZ01B) Board Support Packageリファレンスマニュアル
MPU-9250.h
[詳解]
1 
8 /*
9 Copyright 2015 Cerevo Inc.
10 
11 Licensed under the Apache License, Version 2.0 (the "License");
12 you may not use this file except in compliance with the License.
13 You may obtain a copy of the License at
14 
15  http://www.apache.org/licenses/LICENSE-2.0
16 
17 Unless required by applicable law or agreed to in writing, software
18 distributed under the License is distributed on an "AS IS" BASIS,
19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 See the License for the specific language governing permissions and
21 limitations under the License.
22 */
23 
24 #ifndef _MPU_9250_H_
25 #define _MPU_9250_H_
26 
27 #include <stdint.h>
28 #include <stdbool.h>
29 #include "SPI_TZ10xx.h"
30 
35 typedef struct {
36  float x;
37  float y;
38  float z;
39  uint16_t raw_x;
40  uint16_t raw_y;
41  uint16_t raw_z;
43 
48 typedef struct {
49  float x;
50  float y;
51  float z;
52  uint16_t raw_x;
53  uint16_t raw_y;
54  uint16_t raw_z;
56 
61 typedef struct {
62  float x;
63  float y;
64  float z;
65  uint16_t raw_x;
66  uint16_t raw_y;
67  uint16_t raw_z;
69 
74 typedef struct {
75  uint16_t raw;
77 
78 /*
79  * MPU-9250
80  */
84 /* @{ */
85 #define MPU9250_REG_SELF_TEST_X_GYRO (0)
86 #define MPU9250_REG_SELF_TEST_Y_GYRO (1)
87 #define MPU9250_REG_SELF_TEST_Z_GYRO (2)
88 /* --- */
89 #define MPU9250_REG_SELF_TEST_X_ACCEL (13)
90 #define MPU9250_REG_SELF_TEST_Y_ACCEL (14)
91 #define MPU9250_REG_SELF_TEST_Z_ACCEL (15)
92 /* --- */
93 #define MPU9250_REG_XG_OFFSET_HL (19)
94 #define MPU9250_REG_XG_OFFSET_HH (20)
95 #define MPU9250_REG_YG_OFFSET_HL (21)
96 #define MPU9250_REG_YG_OFFSET_HH (22)
97 #define MPU9250_REG_ZG_OFFSET_HL (23)
98 #define MPU9250_REG_ZG_OFFSET_HH (23)
99 #define MPU9250_REG_SMPLRT_DIV (25)
100 #define MPU9250_REG_CONFIG (26)
101 #define MPU9250_REG_GYRO_CONFIG (27)
102 #define MPU9250_REG_ACCEL_CONFIG (28)
103 #define MPU9250_REG_ACCEL_CONFIG2 (29)
104 #define MPU9250_REG_LP_ACCEL_ODR (30)
105 #define MPU9250_REG_WOM_THR (31)
106 /* --- */
107 #define MPU9250_REG_FIFO_EN (35)
108 #define MPU9250_REG_I2C_MST_CTRL (36)
109 #define MPU9250_REG_I2C_SLV0_ADDR (37)
110 #define MPU9250_REG_I2C_SLV0_REG (38)
111 #define MPU9250_REG_I2C_SLV0_CTRL (39)
112 #define MPU9250_REG_I2C_SLV1_ADDR (40)
113 #define MPU9250_REG_I2C_SLV1_REG (41)
114 #define MPU9250_REG_I2C_SLV1_CTRL (42)
115 #define MPU9250_REG_I2C_SLV2_ADDR (43)
116 #define MPU9250_REG_I2C_SLV2_REG (44)
117 #define MPU9250_REG_I2C_SLV2_CTRL (45)
118 #define MPU9250_REG_I2C_SLV3_ADDR (46)
119 #define MPU9250_REG_I2C_SLV3_REG (47)
120 #define MPU9250_REG_I2C_SLV3_CTRL (48)
121 #define MPU9250_REG_I2C_SLV4_ADDR (49)
122 #define MPU9250_REG_I2C_SLV4_REG (50)
123 #define MPU9250_REG_I2C_SLV4_DO (51)
124 #define MPU9250_REG_I2C_SLV4_CTRL (52)
125 #define MPU9250_REG_I2C_SLV4_DI (53)
126 #define MPU9250_REG_I2C_MST_STATUS (54)
127 #define MPU9250_REG_INT_PIN_CFG (55)
128 #define MPU9250_REG_INT_ENABLE (56)
129 /* --- */
130 #define MPU9250_REG_INT_STATUS (58)
131 #define MPU9250_REG_ACCEL_XOUT_HL (59)
132 #define MPU9250_REG_ACCEL_XOUT_HH (60)
133 #define MPU9250_REG_ACCEL_YOUT_HL (61)
134 #define MPU9250_REG_ACCEL_YOUT_HH (62)
135 #define MPU9250_REG_ACCEL_ZOUT_HL (63)
136 #define MPU9250_REG_ACCEL_ZOUT_HH (64)
137 #define MPU9250_REG_TEMP_HL (65)
138 #define MPU9250_REG_TEMP_HH (66)
139 #define MPU9250_REG_GYRO_XOUT_HL (67)
140 #define MPU9250_REG_GYRO_XOUT_HH (68)
141 #define MPU9250_REG_GYRO_YOUT_HL (69)
142 #define MPU9250_REG_GYRO_YOUT_HH (70)
143 #define MPU9250_REG_GYRO_ZOUT_HL (71)
144 #define MPU9250_REG_GYRO_ZOUT_HH (72)
145 #define MPU9250_REG_EXT_SENS_DATA_00 (73)
146 /* --- */
147 #define MPU9250_REG_I2C_SLV0_DO (99)
148 #define MPU9250_REG_I2C_SLV1_DO (100)
149 #define MPU9250_REG_I2C_SLV2_DO (101)
150 #define MPU9250_REG_I2C_SLV3_DO (102)
151 #define MPU9250_REG_I2C_MST_DELAY_CTRL (103)
152 #define MPU9250_REG_SIGNAL_PATH_RESET (104)
153 #define MPU9250_REG_MOT_DETECT_CTRL (105)
154 #define MPU9250_REG_USER_CTRL (106)
155 #define MPU9250_REG_PWR_MGMT_1 (107)
156 #define MPU9250_REG_PWR_MGMT_2 (108)
157 /* --- */
158 #define MPU9250_REG_FIFO_COUNT_HL (114)
159 #define MPU9250_REG_FIFO_COUNT_HH (115)
160 #define MPU9250_REG_FIFO_R_W (116)
161 #define MPU9250_REG_WHO_AM_I (117)
162 /* --- */
163 #define MPU9250_REG_XA_OFFSET_HL (119)
164 #define MPU9250_REG_XA_OFFSET_HH (120)
165 /* --- */
166 #define MPU9250_REG_YA_OFFSET_HL (122)
167 #define MPU9250_REG_YA_OFFSET_HH (123)
168 /* --- */
169 #define MPU9250_REG_ZA_OFFSET_HL (125)
170 #define MPU9250_REG_ZA_OFFSET_HH (126)
171 /* @} */
172 
177  /* @{ */
178 #define AK8963_I2C_ADDR (0x0c)
179 /* @} */
180 
182 /* @{ */
183 #define AK8963_REG_WIA (0x00)
184 #define AK8963_REG_INFO (0x01)
185 #define AK8963_REG_ST1 (0x02)
186 #define AK8963_REG_HX_LH (0x03)
187 #define AK8963_REG_HX_HH (0x04)
188 #define AK8963_REG_HY_LH (0x05)
189 #define AK8963_REG_HY_HH (0x06)
190 #define AK8963_REG_HZ_LH (0x07)
191 #define AK8963_REG_HZ_HH (0x08)
192 #define AK8963_REG_ST2 (0x09)
193 #define AK8963_REG_CNTL1 (0x0A)
194 #define AK8963_REG_CNTL2 (0x0B)
195 #define AK8963_REG_ASTC (0x0C)
196 /* --- */
197 #define AK8963_REG_ASAX (0x10)
198 #define AK8963_REG_ASAY (0x11)
199 #define AK8963_REG_ASAZ (0x12)
200 /* @} */
201 
206 typedef enum {
213 
218 typedef enum {
225 
230 typedef enum {
241 
246 typedef enum {
257 
265 bool MPU9250_drv_init(TZ10XX_DRIVER_SPI *spi_drv);
266 
278 
285 bool MPU9250_drv_stop_maesure(void);
286 
295 
304 
313 
322 
323 #endif
Definition: MPU-9250.h:220
Definition: MPU-9250.h:252
uint16_t raw_y
Definition: MPU-9250.h:53
Definition: MPU-9250.h:221
Definition: MPU-9250.h:237
Definition: MPU-9250.h:238
Definition: MPU-9250.h:255
Definition: MPU-9250.h:254
Definition: MPU-9250.h:249
Definition: MPU-9250.h:219
Definition: MPU-9250.h:223
uint16_t raw
Definition: MPU-9250.h:75
Definition: MPU-9250.h:253
MPU9250 chip temperature value.
Definition: MPU-9250.h:74
Definition: MPU-9250.h:251
bool MPU9250_drv_read_gyro(MPU9250_gyro_val *gyro_val)
Read maesured gyro value.
Definition: MPU-9250.c:276
float z
Definition: MPU-9250.h:51
Definition: MPU-9250.h:239
Definition: MPU-9250.h:222
Definition: MPU-9250.h:236
Definition: MPU-9250.h:234
Definition: MPU-9250.h:235
Definition: MPU-9250.h:208
Definition: MPU-9250.h:210
Definition: MPU-9250.h:248
uint16_t raw_z
Definition: MPU-9250.h:41
float x
Definition: MPU-9250.h:36
bool MPU9250_drv_stop_maesure(void)
Stop maesure.
Definition: MPU-9250.c:260
MPU9250 accel value.
Definition: MPU-9250.h:48
Definition: MPU-9250.h:231
Definition: MPU-9250.h:211
uint16_t raw_x
Definition: MPU-9250.h:65
bool MPU9250_drv_init(TZ10XX_DRIVER_SPI *spi_drv)
Initialize MPU9250 driver.
Definition: MPU-9250.c:106
uint16_t raw_y
Definition: MPU-9250.h:40
float x
Definition: MPU-9250.h:62
MPU9250_BIT_A_DLPFCFG
Definition: MPU-9250.h:246
bool MPU9250_drv_start_maesure(MPU9250_BIT_GYRO_FS_SEL gyro_fs, MPU9250_BIT_ACCEL_FS_SEL accel_fs, MPU9250_BIT_DLPF_CFG dlpf_cfg, MPU9250_BIT_A_DLPFCFG a_dlpfcfg)
Start maesure.
Definition: MPU-9250.c:198
bool MPU9250_drv_read_magnetometer(MPU9250_magnetometer_val *magnetometer_val)
Read magnetometer value.
Definition: MPU-9250.c:359
float y
Definition: MPU-9250.h:50
uint16_t raw_x
Definition: MPU-9250.h:52
Definition: MPU-9250.h:209
float z
Definition: MPU-9250.h:38
bool MPU9250_drv_read_accel(MPU9250_accel_val *accel_val)
Read maesured accel value.
Definition: MPU-9250.c:306
float x
Definition: MPU-9250.h:49
float y
Definition: MPU-9250.h:37
MPU9250_BIT_GYRO_FS_SEL
Definition: MPU-9250.h:218
float z
Definition: MPU-9250.h:64
float y
Definition: MPU-9250.h:63
MPU9250_BIT_ACCEL_FS_SEL
Definition: MPU-9250.h:206
uint16_t raw_z
Definition: MPU-9250.h:54
uint16_t raw_x
Definition: MPU-9250.h:39
bool MPU9250_drv_read_temperature(MPU9250_temperature_val *temperature_val)
Read maesured temperature value.
Definition: MPU-9250.c:336
MPU9250_BIT_DLPF_CFG
Definition: MPU-9250.h:230
uint16_t raw_y
Definition: MPU-9250.h:66
uint16_t raw_z
Definition: MPU-9250.h:67
Definition: MPU-9250.h:207
Definition: MPU-9250.h:233
Definition: MPU-9250.h:232
Definition: MPU-9250.h:250
Definition: MPU-9250.h:247
AK8963 magnetometer value.
Definition: MPU-9250.h:61
MPU9250 gyro value.
Definition: MPU-9250.h:35