source: rtos_arduino/trunk/arduino_lib/libraries/NAxesMotion/NAxisMotion.h@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 33.1 KB
Line 
1/****************************************************************************
2* Copyright (C) 2011 - 2014 Bosch Sensortec GmbH
3*
4* NAxisMotion.h
5* Date: 2015/02/10
6* Revision: 3.0 $
7*
8* Usage: Header file of the C++ Wrapper for the BNO055 Sensor API
9*
10****************************************************************************
11*
12* Added Arduino M0/M0 Pro support
13*
14* Date: 07/27/2015
15*
16* Modified by: Arduino.org development Team.
17*
18****************************************************************************
19/***************************************************************************
20* License:
21*
22* Redistribution and use in source and binary forms, with or without
23* modification, are permitted provided that the following conditions are met:
24*
25* Redistributions of source code must retain the above copyright
26* notice, this list of conditions and the following disclaimer.
27*
28* Redistributions in binary form must reproduce the above copyright
29* notice, this list of conditions and the following disclaimer in the
30* documentation and/or other materials provided with the distribution.
31*
32* Neither the name of the copyright holder nor the names of the
33* contributors may be used to endorse or promote products derived from
34* this software without specific prior written permission.
35*
36* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
37* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
40* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
46*
47* The information provided is believed to be accurate and reliable.
48* The copyright holder assumes no responsibility for the consequences of use
49* of such information nor for any infringement of patents or
50* other rights of third parties which may result from its use.
51* No license is granted by implication or otherwise under any patent or
52* patent rights of the copyright holder.
53*/
54#ifndef __NAXISMOTION_H__
55#define __NAXISMOTION_H__
56
57
58
59
60extern "C" {
61#include <utility/BNO055.h>
62}
63#include <Wire.h>
64#include "Arduino.h"
65
66//Custom Data structures
67//Structure to hold the calibration status
68struct bno055_calib_stat_t {
69 uint8_t accel; //Calibration Status of the accelerometer
70 uint8_t mag; //Calibration Status of the magnetometer
71 uint8_t gyro; //Calibration Status of the gyroscope
72 uint8_t system; //Calibration Status of the overall system
73};
74
75//Structure to hold the accelerometer configurations
76struct bno055_accel_stat_t {
77 uint8_t range; //Range: 2G - 16G
78 uint8_t bandwidth; //Bandwidth: 7.81Hz - 1000Hz
79 uint8_t powerMode; //Power mode: Normal - Deep suspend
80};
81
82//GPIO pins used for controlling the Sensor
83#define RESET_PIN 4 //GPIO to reset the BNO055 (RESET pin has to be HIGH for the BNO055 to operate)
84
85#if defined(__AVR_ATmega32U4__) //Arduino Yun and Leonardo
86#define INT_PIN 4 //GPIO to receive the Interrupt from the BNO055 for the Arduino Uno(Interrupt is visible on the INT LED on the Shield)
87#elif defined(ARDUINO_ARCH_SAM) //INT_PIN is the interrupt number not the interrupt pin
88#define INT_PIN 2
89#elif defined(ARDUINO_ARCH_SAMD)
90#define INT_PIN 7
91#else
92#define INT_PIN 0
93#endif
94
95#define ENABLE 1 //For use in function parameters
96#define DISABLE 0 //For use in function parameters
97#define NO_MOTION 1 //Enables the no motion interrupt
98#define SLOW_MOTION 0 //Enables the slow motion interrupt
99#define ANDROID 1 //To set the Output Data Format to Android style
100
101#if defined(ARDUINO_SAM_DUE)
102#define I2C Wire1 //Define which I2C bus is used. Wire1 for the Arduino Due
103#else
104#define I2C Wire //Or Wire
105#endif
106
107#define INIT_PERIOD 600 //Initialization period set to 600ms
108#define RESET_PERIOD 300 //Reset period set to 300ms
109#define POST_INIT_PERIOD 50 //Post initialization delay of 50ms
110#define MANUAL 1 //To manually call the update data functions
111#define AUTO 0 //To automatically call the update data functions
112class NAxisMotion {
113private:
114 bool dataUpdateMode; //Variable to store the mode of updating data
115 struct bno055_t myBNO; //Structure that stores the device information
116 struct bno055_accel_float_t accelData; //Structure that holds the accelerometer data
117 struct bno055_mag_float_t magData; //Structure that holds the magnetometer data
118 struct bno055_gyro_float_t gyroData; //Structure that holds the gyroscope data
119 struct bno055_quaternion_t quatData; //Structure that holds the quaternion data
120 struct bno055_euler_float_t eulerData; //Structure that holds the euler data
121 struct bno055_linear_accel_float_t linearAccelData; //Structure that holds the linear acceleration data
122 struct bno055_gravity_float_t gravAccelData; //Structure that holds the gravity acceleration data
123 struct bno055_calib_stat_t calibStatus; //Structure to hold the calibration status
124 struct bno055_accel_stat_t accelStatus; //Structure to hold the status of the accelerometer configurations
125public:
126 //Function Declarations
127 /*******************************************************************************************
128 *Description: Constructor of the class with the default initialization
129 *Input Parameters: None
130 *Return Parameter: None
131 *******************************************************************************************/
132 NAxisMotion();
133
134 /*******************************************************************************************
135 *Description: Function with the bare minimum initialization
136 *Input Parameters: None
137 *Return Parameter: None
138 *******************************************************************************************/
139#if defined(ARDUINO_ARCH_SAMD)
140 void initSensor(unsigned int address = 0x29);
141#else /* !defined(ARDUINO_ARCH_SAMD) */
142 void initSensor(unsigned int address = 0x28);
143#endif /* defined(ARDUINO_ARCH_SAMD) */
144
145 /*******************************************************************************************
146 *Description: This function is used to reset the BNO055
147 *Input Parameters: None
148 *Return Parameter: None
149 *******************************************************************************************/
150 void resetSensor(unsigned int address);
151
152 /*******************************************************************************************
153 *Description: This function is used to set the operation mode of the BNO055
154 *Input Parameters:
155 * byte operationMode: To assign which operation mode the device has to
156 * ---------------------------------------------------
157 * Constant Definition Constant Value Comment
158 * ---------------------------------------------------
159 * OPERATION_MODE_CONFIG 0x00 Configuration Mode
160 * (Transient Mode)
161 * OPERATION_MODE_ACCONLY 0x01 Accelerometer only
162 * OPERATION_MODE_MAGONLY 0x02 Magnetometer only
163 * OPERATION_MODE_GYRONLY 0x03 Gyroscope only
164 * OPERATION_MODE_ACCMAG 0x04 Accelerometer and Magnetometer only
165 * OPERATION_MODE_ACCGYRO 0x05 Accelerometer and Gyroscope only
166 * OPERATION_MODE_MAGGYRO 0x06 Magnetometer and Gyroscope only
167 * OPERATION_MODE_AMG 0x07 Accelerometer, Magnetometer and
168 * Gyroscope (without fusion)
169 * OPERATION_MODE_IMUPLUS 0x08 Inertial Measurement Unit
170 * (Accelerometer and Gyroscope
171 * Sensor Fusion Mode)
172 * OPERATION_MODE_COMPASS 0x09 Tilt Compensated Compass
173 * (Accelerometer and Magnetometer
174 * Sensor Fusion Mode)
175 * OPERATION_MODE_M4G 0x0A Magnetometer and Accelerometer Sensor
176 * Fusion Mode
177 * OPERATION_MODE_NDOF_FMC_OFF 0x0B 9 Degrees of Freedom Sensor Fusion
178 * with Fast Magnetometer Calibration Off
179 * OPERATION_MODE_NDOF 0x0C 9 Degrees of Freedom Sensor Fusion
180 *Return Parameter: None
181 *******************************************************************************************/
182 void setOperationMode(byte operationMode);
183
184 /*******************************************************************************************
185 *Description: This function is used to set the power mode
186 *Input Parameters:
187 * byte powerMode: To assign the power mode the device has to switch to
188 * --------------------------------------
189 * Constant Definition Constant Value
190 * --------------------------------------
191 * POWER_MODE_NORMAL 0x00
192 * POWER_MODE_LOWPOWER 0x01
193 * POWER_MODE_SUSPEND 0x02
194 *Return Parameter:
195 *******************************************************************************************/
196 void setPowerMode(byte powerMode);
197
198 /*******************************************************************************************
199 *Description: This function is used to update the accelerometer data in m/s2
200 *Input Parameters: None
201 *Return Parameter: None
202 *******************************************************************************************/
203 void updateAccel(void);
204
205 /*******************************************************************************************
206 *Description: This function is used to update the magnetometer data in microTesla
207 *Input Parameters: None
208 *Return Parameter: None
209 *******************************************************************************************/
210 void updateMag(void);
211
212 /*******************************************************************************************
213 *Description: This function is used to update the gyroscope data in deg/s
214 *Input Parameters: None
215 *Return Parameter: None
216 *******************************************************************************************/
217 void updateGyro(void);
218
219 /*******************************************************************************************
220 *Description: This function is used to update the quaternion data
221 *Input Parameters: None
222 *Return Parameter: None
223 *******************************************************************************************/
224 void updateQuat(void);
225
226 /*******************************************************************************************
227 *Description: This function is used to update the euler data
228 *Input Parameters: None
229 *Return Parameter: None
230 *******************************************************************************************/
231 void updateEuler(void);
232
233 /*******************************************************************************************
234 *Description: This function is used to update the linear acceleration data in m/s2
235 *Input Parameters: None
236 *Return Parameter: None
237 *******************************************************************************************/
238 void updateLinearAccel(void);
239
240 /*******************************************************************************************
241 *Description: This function is used to update the gravity acceleration data in m/s2
242 *Input Parameters: None
243 *Return Parameter: None
244 *******************************************************************************************/
245 void updateGravAccel(void);
246
247 /*******************************************************************************************
248 *Description: This function is used to update the calibration status
249 *Input Parameters: None
250 *Return Parameter: None
251 *******************************************************************************************/
252 void updateCalibStatus(void);
253
254 /*******************************************************************************************
255 *Description: This function is used to write the accelerometer configurations
256 *Input Parameters:
257 * uint8_t range: To assign the range of the accelerometer
258 * --------------------------------------
259 * Constant Definition Constant Value
260 * --------------------------------------
261 * ACCEL_RANGE_2G 0X00
262 * ACCEL_RANGE_4G 0X01
263 * ACCEL_RANGE_8G 0X02
264 * ACCEL_RANGE_16G 0X03
265 * uint8_t bandwidth: To assign the filter bandwidth of the accelerometer
266 * --------------------------------------
267 * Constant Definition Constant Value
268 * --------------------------------------
269 * ACCEL_BW_7_81HZ 0x00
270 * ACCEL_BW_15_63HZ 0x01
271 * ACCEL_BW_31_25HZ 0x02
272 * ACCEL_BW_62_5HZ 0X03
273 * ACCEL_BW_125HZ 0X04
274 * ACCEL_BW_250HZ 0X05
275 * ACCEL_BW_500HZ 0X06
276 * ACCEL_BW_1000HZ 0X07
277 * uint8_t powerMode: To assign the power mode of the accelerometer
278 * --------------------------------------
279 * Constant Definition Constant Value
280 * --------------------------------------
281 * ACCEL_NORMAL 0X00
282 * ACCEL_SUSPEND 0X01
283 * ACCEL_LOWPOWER_1 0X02
284 * ACCEL_STANDBY 0X03
285 * ACCEL_LOWPOWER_2 0X04
286 * ACCEL_DEEPSUSPEND 0X05
287 *Return Parameter: None
288 *******************************************************************************************/
289 void writeAccelConfig(uint8_t range, uint8_t bandwidth, uint8_t powerMode);
290
291 /*******************************************************************************************
292 *Description: This function is used to update the accelerometer configurations
293 *Input Parameters: None
294 *Return Parameter: None
295 *******************************************************************************************/
296 void updateAccelConfig(void);
297
298 /*******************************************************************************************
299 *Description: This function is used to control which axis of the accelerometer triggers the
300 * interrupt
301 *Input Parameters:
302 * bool xStatus: To know whether the x axis has to trigger the interrupt
303 * ---------------------------------------------------
304 * Constant Definition Constant Value Comment
305 * ---------------------------------------------------
306 * ENABLE 1 Enables interrupts from that axis
307 * DISABLE 0 Disables interrupts from that axis
308 * bool yStatus: To know whether the x axis has to trigger the interrupt
309 * ---------------------------------------------------
310 * Constant Definition Constant Value Comment
311 * ---------------------------------------------------
312 * ENABLE 1 Enables interrupts from that axis
313 * DISABLE 0 Disables interrupts from that axis
314 * bool zStatus: To know whether the x axis has to trigger the interrupt
315 * ---------------------------------------------------
316 * Constant Definition Constant Value Comment
317 * ---------------------------------------------------
318 * ENABLE 1 Enables interrupts from that axis
319 * DISABLE 0 Disables interrupts from that axis
320 *Return Parameter: None
321 *******************************************************************************************/
322 void accelInterrupts(bool xStatus, bool yStatus, bool zStatus);
323
324 /*******************************************************************************************
325 *Description: This function is used to reset the interrupt line
326 *Input Parameters: None
327 *Return Parameter: None
328 *******************************************************************************************/
329 void resetInterrupt(void);
330
331 /*******************************************************************************************
332 *Description: This function is used to enable the any motion interrupt based on the
333 * accelerometer
334 *Input Parameters:
335 * uint8_t threshold: The threshold that triggers the any motion interrupt
336 * The threshold should be entered as an integer. The corresponding value of
337 * the threshold depends on the range that has been set on the
338 * accelerometer. Below is a table showing the value of 1LSB in
339 * corresponding units.
340 * Resolution:
341 * ACCEL_RANGE_2G, 1LSB = 3.91mg = ~0.03835m/s2
342 * ACCEL_RANGE_4G, 1LSB = 7.81mg = ~0.07661m/s2
343 * ACCEL_RANGE_8G, 1LSB = 15.6mg = ~0.15303m/s2
344 * ACCEL_RANGE_16G, 1LSB = 31.3mg = ~0.30705m/s2
345 * Maximum:
346 * ACCEL_RANGE_2G, 1LSB = 996mg = ~9.77076m/s2,
347 * ACCEL_RANGE_4G, 1LSB = 1.99g = ~19.5219m/s2
348 * ACCEL_RANGE_8G, 1LSB = 3.98g = ~39.0438m/s2
349 * ACCEL_RANGE_16G, 1LSB = 7.97g = ~97.1857m/s2
350 * uint8_t duration: The duration for which the desired threshold exist
351 * The time difference between the successive acceleration signals depends
352 * on the selected bandwidth and equates to 1/(2*bandwidth).
353 * In order to suppress false triggers, the interrupt is only generated (cleared)
354 * if a certain number N of consecutive slope data points is larger (smaller)
355 * than the slope 'threshold'. This number is set by the 'duration'.
356 * It is N = duration + 1.
357 * Resolution:
358 * ACCEL_BW_7_81HZ, 1LSB = 64ms
359 * ACCEL_BW_15_63HZ, 1LSB = 32ms
360 * ACCEL_BW_31_25HZ, 1LSB = 16ms
361 * ACCEL_BW_62_5HZ, 1LSB = 8ms
362 * ACCEL_BW_125HZ, 1LSB = 4ms
363 * ACCEL_BW_250HZ, 1LSB = 2ms
364 * ACCEL_BW_500HZ, 1LSB = 1ms
365 * ACCEL_BW_1000HZ, 1LSB = 0.5ms
366 *Return Parameter: None
367 *******************************************************************************************/
368 void enableAnyMotion(uint8_t threshold, uint8_t duration);
369
370 /*******************************************************************************************
371 *Description: This function is used to disable the any motion interrupt
372 *Input Parameters: None
373 *Return Parameter: None
374 *******************************************************************************************/
375 void disableAnyMotion(void);
376
377
378 /*******************************************************************************************
379 *Description: This function is used to enable the slow or no motion interrupt based on the
380 * accelerometer
381 *Input Parameters:
382 * uint8_t threshold: The threshold that triggers the no motion interrupt
383 * The threshold should be entered as an integer. The corresponding value of
384 * the threshold depends on the range that has been set on the
385 * accelerometer. Below is a table showing the value of 1LSB in
386 * corresponding units.
387 * Resolution:
388 * ACCEL_RANGE_2G, 1LSB = 3.91mg = ~0.03835m/s2
389 * ACCEL_RANGE_4G, 1LSB = 7.81mg = ~0.07661m/s2
390 * ACCEL_RANGE_8G, 1LSB = 15.6mg = ~0.15303m/s2
391 * ACCEL_RANGE_16G, 1LSB = 31.3mg = ~0.30705m/s2
392 * Maximum:
393 * ACCEL_RANGE_2G, 1LSB = 996mg = ~9.77076m/s2,
394 * ACCEL_RANGE_4G, 1LSB = 1.99g = ~19.5219m/s2
395 * ACCEL_RANGE_8G, 1LSB = 3.98g = ~39.0438m/s2
396 * ACCEL_RANGE_16G, 1LSB = 7.97g = ~97.1857m/s2
397 * uint8_t duration: The duration for which the desired threshold should be surpassed
398 * The time difference between the successive acceleration signals depends
399 * on the selected bandwidth and equates to 1/(2*bandwidth).
400 * In order to suppress false triggers, the interrupt is only generated (cleared)
401 * if a certain number N of consecutive slope data points is larger (smaller)
402 * than the slope 'threshold'. This number is set by the 'duration'.
403 * It is N = duration + 1.
404 * Resolution:
405 * ACCEL_BW_7_81HZ, 1LSB = 64ms
406 * ACCEL_BW_15_63HZ, 1LSB = 32ms
407 * ACCEL_BW_31_25HZ, 1LSB = 16ms
408 * ACCEL_BW_62_5HZ, 1LSB = 8ms
409 * ACCEL_BW_125HZ, 1LSB = 4ms
410 * ACCEL_BW_250HZ, 1LSB = 2ms
411 * ACCEL_BW_500HZ, 1LSB = 1ms
412 * ACCEL_BW_1000HZ, 1LSB = 0.5ms
413 * bool motion: To trigger either a Slow motion or a No motion interrupt
414 * ---------------------------------------------------
415 * Constant Definition Constant Value Comment
416 * ---------------------------------------------------
417 * NO_MOTION 1 Enables the no motion interrupt
418 * SLOW_MOTION 0 Enables the slow motion interrupt
419 *Return Parameter: None
420 *******************************************************************************************/
421 void enableSlowNoMotion(uint8_t threshold, uint8_t duration, bool motion);
422
423 /*******************************************************************************************
424 *Description: This function is used to disable the slow or no motion interrupt
425 *Input Parameters: None
426 *Return Parameter: None
427 *******************************************************************************************/
428 void disableSlowNoMotion(void);
429
430 /*******************************************************************************************
431 *Description: This function is used to change the mode of updating the local data
432 *Input Parameters: None
433 *Return Parameter: None
434 *******************************************************************************************/
435 void setUpdateMode(bool updateMode);
436
437 /*******************************************************************************************
438 *Description: This function is used to return the x-axis of the accelerometer data
439 *Input Parameters: None
440 *Return Parameter:
441 * float: X-axis accelerometer data in m/s2
442 *******************************************************************************************/
443 float readAccelX(void);
444
445 /*******************************************************************************************
446 *Description: This function is used to return the y-axis of the accelerometer data
447 *Input Parameters: None
448 *Return Parameter:
449 * float: Y-axis accelerometer data in m/s2
450 *******************************************************************************************/
451 float readAccelY(void);
452
453 /*******************************************************************************************
454 *Description: This function is used to return the z-axis of the accelerometer data
455 *Input Parameters: None
456 *Return Parameter:
457 * float: Z-axis accelerometer data in m/s2
458 *******************************************************************************************/
459 float readAccelZ(void);
460
461 /*******************************************************************************************
462 *Description: This function is used to return the x-axis of the gyroscope data
463 *Input Parameters: None
464 *Return Parameter:
465 * float: X-axis gyroscope data in deg/s
466 *******************************************************************************************/
467 float readGyroX(void);
468
469 /*******************************************************************************************
470 *Description: This function is used to return the y-axis of the gyroscope data
471 *Input Parameters: None
472 *Return Parameter:
473 * float: Y-axis gyroscope data in deg/s
474 *******************************************************************************************/
475 float readGyroY(void);
476
477 /*******************************************************************************************
478 *Description: This function is used to return the z-axis of the gyroscope data
479 *Input Parameters: None
480 *Return Parameter:
481 * float: Z-axis gyroscope data in deg/s
482 *******************************************************************************************/
483 float readGyroZ(void);
484
485 /*******************************************************************************************
486 *Description: This function is used to return the x-axis of the magnetometer data
487 *Input Parameters: None
488 *Return Parameter:
489 * float: X-axis magnetometer data in µT
490 *******************************************************************************************/
491 float readMagX(void);
492
493 /*******************************************************************************************
494 *Description: This function is used to return the y-axis of the magnetometer data
495 *Input Parameters: None
496 *Return Parameter:
497 * float: Y-axis magnetometer data in µT
498 *******************************************************************************************/
499 float readMagY(void);
500
501 /*******************************************************************************************
502 *Description: This function is used to return the z-axis of the magnetometer data
503 *Input Parameters: None
504 *Return Parameter:
505 * float: Z-axis magnetometer data in µT
506 *******************************************************************************************/
507 float readMagZ(void);
508
509 /*******************************************************************************************
510 *Description: This function is used to return the w-axis of the quaternion data
511 *Input Parameters: None
512 *Return Parameter:
513 * int16_t: W-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
514 *******************************************************************************************/
515 int16_t readQuatW(void);
516
517 /*******************************************************************************************
518 *Description: This function is used to return the x-axis of the quaternion data
519 *Input Parameters: None
520 *Return Parameter:
521 * int16_t: X-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
522 *******************************************************************************************/
523 int16_t readQuatX(void);
524
525 /*******************************************************************************************
526 *Description: This function is used to return the y-axis of the quaternion data
527 *Input Parameters: None
528 *Return Parameter:
529 * int16_t: Y-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
530 *******************************************************************************************/
531 int16_t readQuatY(void);
532
533 /*******************************************************************************************
534 *Description: This function is used to return the z-axis of the quaternion data
535 *Input Parameters: None
536 *Return Parameter:
537 * int16_t: Z-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
538 *******************************************************************************************/
539 int16_t readQuatZ(void);
540
541 /*******************************************************************************************
542 *Description: This function is used to return the heading(yaw) of the euler data
543 *Input Parameters: None
544 *Return Parameter:
545 * float: Heading of the euler data
546 *******************************************************************************************/
547 float readEulerHeading(void);
548
549 /*******************************************************************************************
550 *Description: This function is used to return the roll of the euler data
551 *Input Parameters: None
552 *Return Parameter:
553 * float: Roll of the euler data
554 *******************************************************************************************/
555 float readEulerRoll(void);
556
557 /*******************************************************************************************
558 *Description: This function is used to return the pitch of the euler data
559 *Input Parameters: None
560 *Return Parameter:
561 * float: Pitch of the euler data
562 *******************************************************************************************/
563 float readEulerPitch(void);
564
565 /*******************************************************************************************
566 *Description: This function is used to return the x-axis of the linear acceleration data
567 * (accelerometer data without the gravity vector)
568 *Input Parameters: None
569 *Return Parameter:
570 * float: X-axis Linear Acceleration data in m/s2
571 *******************************************************************************************/
572 float readLinearAccelX(void);
573
574 /*******************************************************************************************
575 *Description: This function is used to return the y-axis of the linear acceleration data
576 * (accelerometer data without the gravity vector)
577 *Input Parameters: None
578 *Return Parameter:
579 * float: Y-axis Linear Acceleration data in m/s2
580 *******************************************************************************************/
581 float readLinearAccelY(void);
582
583 /*******************************************************************************************
584 *Description: This function is used to return the z-axis of the linear acceleration data
585 * (accelerometer data without the gravity vector)
586 *Input Parameters: None
587 *Return Parameter:
588 * float: Z-axis Linear Acceleration data in m/s2
589 *******************************************************************************************/
590 float readLinearAccelZ(void);
591
592 /*******************************************************************************************
593 *Description: This function is used to return the x-axis of the gravity acceleration data
594 * (accelerometer data with only the gravity vector)
595 *Input Parameters: None
596 *Return Parameter:
597 * float: X-axis Gravity Acceleration data in m/s2
598 *******************************************************************************************/
599 float readGravAccelX(void);
600
601 /*******************************************************************************************
602 *Description: This function is used to return the y-axis of the gravity acceleration data
603 * (accelerometer data with only the gravity vector)
604 *Input Parameters: None
605 *Return Parameter:
606 * float: Y-axis Gravity Acceleration data in m/s2
607 *******************************************************************************************/
608 float readGravAccelY(void);
609
610 /*******************************************************************************************
611 *Description: This function is used to return the z-axis of the gravity acceleration data
612 * (accelerometer data with only the gravity vector)
613 *Input Parameters: None
614 *Return Parameter:
615 * float: Z-axis Gravity Acceleration data in m/s2
616 *******************************************************************************************/
617 float readGravAccelZ(void);
618
619 /*******************************************************************************************
620 *Description: This function is used to return the accelerometer calibration status
621 *Input Parameters: None
622 *Return Parameter:
623 * uint8_t: Accelerometer calibration status, 0-3 (0 - low, 3 - high)
624 *******************************************************************************************/
625 uint8_t readAccelCalibStatus(void);
626
627 /*******************************************************************************************
628 *Description: This function is used to return the gyroscope calibration status
629 *Input Parameters: None
630 *Return Parameter:
631 * uint8_t: Gyroscope calibration status, 0-3 (0 - low, 3 - high)
632 *******************************************************************************************/
633 uint8_t readGyroCalibStatus(void);
634
635 /*******************************************************************************************
636 *Description: This function is used to return the magnetometer calibration status
637 *Input Parameters: None
638 *Return Parameter:
639 * uint8_t: Magnetometer calibration status, 0-3 (0 - low, 3 - high)
640 *******************************************************************************************/
641 uint8_t readMagCalibStatus(void);
642
643 /*******************************************************************************************
644 *Description: This function is used to return the system calibration status
645 *Input Parameters: None
646 *Return Parameter:
647 * uint8_t: System calibration status, 0-3 (0 - low, 3 - high)
648 *******************************************************************************************/
649 uint8_t readSystemCalibStatus(void);
650
651 /*******************************************************************************************
652 *Description: This function is used to return the accelerometer range
653 *Input Parameters: None
654 *Return Parameter:
655 * uint8_t range: Range of the accelerometer
656 * --------------------------------------
657 * Constant Definition Constant Value
658 * --------------------------------------
659 * ACCEL_RANGE_2G 0X00
660 * ACCEL_RANGE_4G 0X01
661 * ACCEL_RANGE_8G 0X02
662 * ACCEL_RANGE_16G 0X03
663 *******************************************************************************************/
664 uint8_t readAccelRange(void);
665
666 /*******************************************************************************************
667 *Description: This function is used to return the accelerometer bandwidth
668 *Input Parameters: None
669 *Return Parameter:
670 * uint8_t bandwidth: Bandwidth of the accelerometer
671 * --------------------------------------
672 * Constant Definition Constant Value
673 * --------------------------------------
674 * ACCEL_BW_7_81HZ 0x00
675 * ACCEL_BW_15_63HZ 0x01
676 * ACCEL_BW_31_25HZ 0x02
677 * ACCEL_BW_62_5HZ 0X03
678 * ACCEL_BW_125HZ 0X04
679 * ACCEL_BW_250HZ 0X05
680 * ACCEL_BW_500HZ 0X06
681 * ACCEL_BW_1000HZ 0X07
682 *******************************************************************************************/
683 uint8_t readAccelBandwidth(void);
684
685 /*******************************************************************************************
686 *Description: This function is used to return the accelerometer power mode
687 *Input Parameters: None
688 *Return Parameter:
689 * uint8_t powerMode: Power mode of the accelerometer
690 * --------------------------------------
691 * Constant Definition Constant Value
692 * --------------------------------------
693 * ACCEL_NORMAL 0X00
694 * ACCEL_SUSPEND 0X01
695 * ACCEL_LOWPOWER_1 0X02
696 * ACCEL_STANDBY 0X03
697 * ACCEL_LOWPOWER_2 0X04
698 * ACCEL_DEEPSUSPEND 0X05
699 *******************************************************************************************/
700 uint8_t readAccelPowerMode(void);
701
702
703
704};
705
706/******************** Bridge Functions for the Sensor API to control the Arduino Hardware******************************************/
707signed char BNO055_I2C_bus_read(unsigned char,unsigned char, unsigned char*, unsigned char);
708signed char BNO055_I2C_bus_write(unsigned char ,unsigned char , unsigned char* , unsigned char );
709void _delay(u_32);
710
711#endif __NAXISMOTION_H__
Note: See TracBrowser for help on using the repository browser.