v1.0

Dependencies:   BNO055_fusion mbed MODSERIAL dsp

Fork of Bosch_BNO055_Fusion_example by Kenji Arai

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sun Apr 05 04:13:55 2015 +0000
Child:
1:b7ed54e16338
Commit message:
Sample program for BNO055.; BNO055 Intelligent 9-axis absolute orientation sensor by Bosch Sensortec.; It includes ACC, MAG and GYRO sensors and Cortex-M0+ processor.

Changed in this revision

BNO055_fusion.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BNO055_fusion.lib	Sun Apr 05 04:13:55 2015 +0000
@@ -0,0 +1,1 @@
+BNO055_fusion#86a17116e8be
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 05 04:13:55 2015 +0000
@@ -0,0 +1,97 @@
+/*
+ * mbed Application program for the mbed Nucleo F401
+ *  BNO055 Intelligent 9-axis absolute orientation sensor
+ *  by Bosch Sensortec
+ *
+ * Copyright (c) 2015 Kenji Arai / JH1PJL
+ *  http://www.page.sannet.ne.jp/kenjia/index.html
+ *  http://mbed.org/users/kenjiArai/
+ *      Created: March     30th, 2015
+ *      Revised: April      5th, 2015
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+ * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+//  Include ---------------------------------------------------------------------------------------
+#include    "mbed.h"
+#include    "BNO055.h"
+
+//  Definition ------------------------------------------------------------------------------------
+
+//  Object ----------------------------------------------------------------------------------------
+Serial pc(USBTX,USBRX);
+I2C    i2c(PB_9, PB_8); // SDA, SCL
+BNO055 imu(i2c);        // addr = BNO055_G_CHIP_ADDR, mode = MODE_NDOF <- as default
+
+//  RAM -------------------------------------------------------------------------------------------
+BNO055_ID_INF_TypeDef       bno055_id_inf;
+BNO055_EULER_TypeDef        euler_angles;
+BNO055_QUATERNION_TypeDef   quaternion;
+BNO055_LIN_ACC_TypeDef      linear_acc;
+BNO055_GRAVITY_TypeDef      gravity;
+BNO055_TEMPERATURE_TypeDef  chip_temp;
+
+//  ROM / Constant data ---------------------------------------------------------------------------
+
+//  Function prototypes ---------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------------------------
+//  Control Program
+//------------------------------------------------------------------------------------------------- 
+int main() {
+    uint8_t i;
+
+    pc.printf("Bosch Sensortec BNO055 test program on " __DATE__ "/" __TIME__ "\r\n");
+    // Is BNO055 avairable?
+    if (imu.chip_ready() == 0){
+        pc.printf("Bosch BNO055 is NOT avirable!!\r\n");
+    }
+    imu.set_mounting_position(MT_P6);
+    pc.printf("AXIS_REMAP_CONFIG:0x%02x, AXIS_REMAP_SIGN:0x%02x\r\n",
+               imu.read_reg0(BNO055_AXIS_MAP_CONFIG), imu.read_reg0(BNO055_AXIS_MAP_SIGN));    
+    imu.read_id_inf(&bno055_id_inf);
+    pc.printf("CHIP:0x%02x, ACC:0x%02x, MAG:0x%02x, GYR:0x%02x, , SW:0x%04x, , BL:0x%02x\r\n",
+               bno055_id_inf.chip_id, bno055_id_inf.acc_id, bno055_id_inf.mag_id,
+               bno055_id_inf.gyr_id, bno055_id_inf.sw_rev_id, bno055_id_inf.bootldr_rev_id);
+    while(1) {
+        pc.printf("Euler Angles data\r\n");
+        for (i = 0; i < 20; i++){
+            imu.get_Euler_Angles(&euler_angles);
+            pc.printf("Heading:%+6.1f [deg], Roll:%+6.1f [deg], Pich:%+6.1f [deg], #%02d\r\n",
+                       euler_angles.h, euler_angles.r, euler_angles.p, i);
+            wait(0.5);
+        }
+        pc.printf("Quaternion data\r\n");
+        for (i = 0; i < 20; i++){
+            imu.get_quaternion(&quaternion);
+            pc.printf("W:%d, X:%d, Y:%d, Z:%d, #%02d\r\n",
+                       quaternion.w, quaternion.x, quaternion.y, quaternion.z, i);
+            wait(0.5);
+        }
+        pc.printf("Linear accel data\r\n");
+        for (i = 0; i < 20; i++){
+            imu.get_linear_accel(&linear_acc);
+            pc.printf("X:%+6.1f [m/s*s], Y:%+6.1f [m/s*s], Z:%+6.1f [m/s*s], #%02d\r\n",
+                       linear_acc.x, linear_acc.y, linear_acc.z, i);
+            wait(0.5);
+        }
+        pc.printf("Gravity vector data\r\n");
+        for (i = 0; i < 20; i++){
+            imu.get_gravity(&gravity);
+            pc.printf("X:%+6.1f [m/s*s], Y:%+6.1f [m/s*s], Z:%+6.1f [m/s*s], #%02d\r\n",
+                       gravity.x, gravity.y, gravity.z, i);
+            wait(0.5);
+        }
+        pc.printf("Chip temperature data\r\n");
+        for (i = 0; i < 20; i++){
+            imu.get_chip_temperature(&chip_temp);
+            pc.printf("Acc chip:%+d [degC], Gyr chip:%+d [degC], #%02d\r\n",
+                       chip_temp.acc_chip, chip_temp.gyr_chip, i);
+            wait(0.5);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 05 04:13:55 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file