bno055.h
Go to the documentation of this file.
1 /***************************************************************************
2  This is a library for the BNO055 orientation sensor
3 
4  Designed specifically to work with the Adafruit BNO055 Breakout.
5 
6  Pick one up today in the adafruit shop!
7  ------> http://www.adafruit.com/products
8 
9  These sensors use I2C to communicate, 2 pins are required to interface.
10 
11  Adafruit invests time and resources providing this open source code,
12  please support Adafruit andopen-source hardware by purchasing products
13  from Adafruit!
14 
15  Written by KTOWN for Adafruit Industries.
16 
17  MIT license, all text above must be included in any redistribution
18  ***************************************************************************/
29 #ifdef YOTTA_CFG_SENSORS_BNO055
30 #ifndef BNO055_H
31 #define BNO055_H
32 
33 #include <stdint.h>
34 #include "kubos-hal/i2c.h"
36 
37 typedef enum
38 {
39  /* Page id register definition */
41 
42  /* PAGE0 REGISTER DEFINITION START*/
50 
51  /* Accel data register */
53 
54  /* Mag data register */
56 
57  /* Gyro data registers */
59 
60  /* Euler data registers */
62 
63  /* Quaternion data registers */
65 
66  /* Linear acceleration data registers */
68 
69  /* Gravity data registers */
71 
72  /* Temperature data register */
74 
75  /* Status registers */
79 
83 
84  /* Unit selection register */
87 
88  /* Mode registers */
91 
94 
95  /* Axis remap registers */
98 
99 
100  /* Accelerometer Offset registers */
107 
108  /* Magnetometer Offset registers */
115 
116  /* Gyroscope Offset register s*/
123 
124  /* Radius registers */
129 } bno055_reg_t;
130 
131 typedef enum {
136 
137 typedef enum {
138  /* Operation mode settings*/
154 
155 typedef enum {
157  REMAP_CONFIG_P1 = 0x24, // default
165 
166 typedef enum {
167  REMAP_SIGN_P0 = 0x04, REMAP_SIGN_P1 = 0x00, // default
175 
176 typedef struct {
177  uint8_t accel_rev;
178  uint8_t mag_rev;
179  uint8_t gyro_rev;
180  uint16_t sw_rev;
181  uint8_t bl_rev;
183 
184 typedef struct {
185  uint16_t accel_offset_x;
186  uint16_t accel_offset_y;
187  uint16_t accel_offset_z;
188  uint16_t gyro_offset_x;
189  uint16_t gyro_offset_y;
190  uint16_t gyro_offset_z;
191  uint16_t mag_offset_x;
192  uint16_t mag_offset_y;
193  uint16_t mag_offset_z;
194 
195  uint16_t accel_radius;
196  uint16_t mag_radius;
198 
199 typedef enum
200 {
207 } vector_type_t;
208 
209 typedef struct
210 {
211  double w;
212  double x;
213  double y;
214  double z;
216 
217 typedef struct
218 {
219  double x;
220  double y;
221  double z;
223 
224 typedef struct
225 {
226  uint8_t status;
227  uint8_t self_test;
228  uint8_t error;
230 
231 typedef struct
232 {
233  uint8_t sys;
234  uint8_t gyro;
235  uint8_t accel;
236  uint8_t mag;
238 
239 /* config functions */
243 KSensorStatus bno055_get_mode(uint8_t * value);
244 
249 
250 /* data functions */
255 
256 /* Functions to deal with raw calibration data */
259 
260 KSensorStatus bno055_check_calibration(uint8_t * count, uint8_t limit, bno055_calibration_data_t * calib);
261 
262 #endif
263 #endif
264 
265 /* @} */
Definition: bno055.h:121
bno055_opmode_t
Definition: bno055.h:137
KSensorStatus bno055_init(bno055_opmode_t mode)
Definition: bno055.h:171
Definition: bno055.h:89
KSensorStatus bno055_get_temperature(int8_t *temp)
KSensorStatus bno055_get_calibration(bno055_calibration_data_t *data)
double x
Definition: bno055.h:219
Definition: bno055.h:90
uint8_t gyro_rev
Definition: bno055.h:179
Definition: bno055.h:93
uint8_t self_test
Definition: bno055.h:227
Definition: bno055.h:231
Definition: bno055.h:102
KSensorStatus bno055_get_rev_info(bno055_rev_info_t *info)
Definition: bno055.h:158
Definition: bno055.h:151
Definition: bno055.h:168
KSensorStatus bno055_set_sensor_offset_struct(const bno055_offsets_t offsets_type)
Definition: bno055.h:112
Definition: bno055.h:61
uint16_t gyro_offset_z
Definition: bno055.h:190
KSensorStatus bno055_get_system_status(bno055_system_status_t *status)
double y
Definition: bno055.h:213
double z
Definition: bno055.h:221
Definition: bno055.h:125
Definition: bno055.h:167
Definition: bno055.h:162
KSensorStatus bno055_set_ext_crystal_use(int use)
Definition: bno055.h:120
KSensorStatus bno055_check_calibration(uint8_t *count, uint8_t limit, bno055_calibration_data_t *calib)
Definition: bno055.h:117
Definition: bno055.h:145
Definition: bno055.h:201
Definition: bno055.h:150
double x
Definition: bno055.h:212
Definition: bno055.h:73
Definition: bno055.h:103
Definition: bno055.h:173
Definition: bno055.h:203
vector_type_t
Definition: bno055.h:199
uint16_t mag_radius
Definition: bno055.h:196
Definition: bno055.h:148
Definition: bno055.h:97
Definition: bno055.h:147
Definition: bno055.h:134
uint8_t status
Definition: bno055.h:226
Definition: bno055.h:132
Definition: bno055.h:161
Definition: bno055.h:101
Definition: bno055.h:149
Definition: bno055.h:217
uint8_t accel
Definition: bno055.h:235
Definition: bno055.h:224
KSensorStatus
Sensor status enum.
Definition: sensors.h:24
uint8_t accel_rev
Definition: bno055.h:177
Definition: bno055.h:86
Definition: bno055.h:55
Definition: bno055.h:40
uint16_t accel_offset_y
Definition: bno055.h:186
double z
Definition: bno055.h:214
uint16_t sw_rev
Definition: bno055.h:180
uint16_t mag_offset_z
Definition: bno055.h:193
uint8_t mag
Definition: bno055.h:236
Definition: bno055.h:127
Definition: bno055.h:49
Definition: bno055.h:76
KSensorStatus bno055_get_mode(uint8_t *value)
Definition: bno055.h:128
Definition: bno055.h:81
Definition: bno055.h:206
Definition: bno055.h:157
Definition: bno055.h:47
Definition: bno055.h:140
Definition: bno055.h:106
uint16_t gyro_offset_y
Definition: bno055.h:189
Definition: bno055.h:142
Definition: bno055.h:43
Definition: bno055.h:52
Definition: bno055.h:143
Definition: bno055.h:46
Definition: bno055.h:82
Definition: bno055.h:58
uint8_t sys
Definition: bno055.h:233
Definition: bno055.h:184
Definition: bno055.h:48
uint8_t error
Definition: bno055.h:228
Definition: bno055.h:85
uint8_t mag_rev
Definition: bno055.h:178
Definition: bno055.h:133
Definition: bno055.h:45
Definition: bno055.h:170
uint16_t accel_offset_z
Definition: bno055.h:187
Definition: bno055.h:144
Definition: bno055.h:119
bno055_axis_remap_config_t
Definition: bno055.h:155
Definition: bno055.h:110
bno055_powermode_t
Definition: bno055.h:131
Definition: bno055.h:64
Definition: bno055.h:204
double y
Definition: bno055.h:220
Definition: bno055.h:167
Definition: bno055.h:118
Definition: bno055.h:146
uint8_t gyro
Definition: bno055.h:234
Definition: bno055.h:92
Definition: bno055.h:96
Definition: bno055.h:111
Definition: bno055.h:122
uint16_t mag_offset_y
Definition: bno055.h:192
Definition: bno055.h:109
KSensorStatus bno055_get_data_vector(vector_type_t type, bno055_vector_data_t *vector)
Definition: bno055.h:209
Definition: bno055.h:113
Definition: bno055.h:152
Definition: bno055.h:70
Definition: bno055.h:169
uint8_t bl_rev
Definition: bno055.h:181
Definition: bno055.h:202
Definition: bno055.h:160
KSensorStatus bno055_get_position(bno055_quat_data_t *quat)
uint16_t accel_radius
Definition: bno055.h:195
uint16_t accel_offset_x
Definition: bno055.h:185
KSensorStatus bno055_setup(bno055_opmode_t mode)
Definition: bno055.h:139
KSensorStatus bno055_get_sensor_offset_struct(bno055_offsets_t *offsets_type)
Definition: bno055.h:141
Definition: bno055.h:172
uint16_t gyro_offset_x
Definition: bno055.h:188
Definition: bno055.h:156
Definition: bno055.h:44
Definition: bno055.h:205
bno055_axis_remap_sign_t
Definition: bno055.h:166
Definition: bno055.h:105
Definition: bno055.h:80
Definition: bno055.h:114
Definition: bno055.h:78
Definition: bno055.h:126
bno055_reg_t
Definition: bno055.h:37
Definition: bno055.h:159
Definition: bno055.h:163
Definition: bno055.h:176
Definition: bno055.h:77
double w
Definition: bno055.h:211
Definition: bno055.h:104
KSensorStatus bno055_set_mode(bno055_opmode_t mode)
KSensorStatus bno055_get_single_data(bno055_reg_t reg, uint8_t *value)
uint16_t mag_offset_x
Definition: bno055.h:191