Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BNO055.h
00001 #ifndef _BNO055_h_ 00002 #define _BNO055_h_ 00003 00004 #include "MicroBit.h" 00005 00006 // Registers 00007 #define CHIP_ID_REGISTER 0x00 00008 #define PAGE_ID_REGISTER 0x07 00009 #define OPR_MODE_REGISTER 0x3d 00010 #define UNIT_SELECTION_REGISTER 0x3b 00011 #define EULER_H_REGISTER_LSB 0x1a 00012 #define EULER_H_REGISTER_MSB 0x1b 00013 #define CALIBRATION_STATUS 0x35 00014 00015 00016 // IDs 00017 #define BNO055_CHIP_ID 0xa0 00018 #define BNO055_ACC_ID 0xfb 00019 #define BNO055_MAG_ID 0x32 00020 #define BNO055_GYRO_ID 0x0f 00021 00022 // Units 00023 #define UNIT_ACC_MSS 0x00 00024 #define UNIT_GYR_DPS 0x00 00025 #define UNIT_EULER_DEG 0x00 00026 #define UNIT_TEMP_C 0x00 00027 #define UNIT_ORI_WIN 0x00 00028 00029 00030 #define NDOF_FUSION_MODE 0x0C 00031 #define IMU_FUSION_MODE 0x08 00032 00033 00034 namespace BNO055 00035 { 00036 00037 00038 class Sensor 00039 { 00040 public: 00041 Sensor(MicroBit & bit); 00042 void Calibrate(); 00043 00044 void ReadEulerAngles(double & heading, double & roll, double & pitch); 00045 00046 private: 00047 MicroBit & _bit; 00048 char _buffer[12]; 00049 uint8_t _I2CAddress; 00050 00051 void LogDeviceId(); 00052 void SelectPage(uint8_t page); 00053 void SelectNDOFFusion(); 00054 void SelectUnits(); 00055 void Init(); 00056 void CheckID(); 00057 uint8_t CalibrationStatus(void); 00058 00059 uint8_t _currentPage; 00060 }; 00061 00062 } 00063 00064 #endif
Generated on Wed Jul 13 2022 09:29:34 by
1.7.2