I2C library for Bosch BNO055 sensor
Dependents: Project Campus_Safety_Bot
Fork of BNO055 by
Diff: BNO055.h
- Revision:
- 1:2c3322a8d417
- Parent:
- 0:24f23c36dd24
- Child:
- 2:695c6e5d239a
--- a/BNO055.h Thu May 28 19:22:25 2015 +0000 +++ b/BNO055.h Sat May 30 18:36:36 2015 +0000 @@ -122,9 +122,11 @@ #define DEG_PER_SEC 0x00 #define RAD_PER_SEC 0x02 #define DEGREES 0x00 -#define RADIANS 0x40 +#define RADIANS 0x04 #define CENTIGRADE 0x00 -#define FAHRENHEIT 0x80 +#define FAHRENHEIT 0x10 +#define WINDOWS 0x00 +#define ANDROID 0x80 //Definitions for power mode #define POWER_MODE_NORMAL 0x00 @@ -132,7 +134,7 @@ #define POWER_MODE_SUSPEND 0x02 //Definitions for operating mode -#define OPERATION_MODE_CONFIG 0x00 +#define OPERATION_MODE_CONFIG 0x00 #define OPERATION_MODE_ACCONLY 0x01 #define OPERATION_MODE_MAGONLY 0x02 #define OPERATION_MODE_GYRONLY 0x03 @@ -170,7 +172,6 @@ char bootload; char serial[16]; }chip; - class BNO055 { @@ -188,13 +189,20 @@ void set_anglerate_units(char units); void set_angle_units(char units); void set_temp_units(char units); + void set_orientation(char units); + void set_mapping(char orient); + void get_accel(void); void get_gyro(void); void get_mag(void); void get_lia(void); void get_grv(void); void get_quat(void); + void get_temp(void); + void get_calib(void); + void read_calibration_data(void); + void write_calibration_data(void); values accel,gyro,mag,lia,gravity; angles euler; @@ -203,14 +211,17 @@ char status; char calibration[22]; chip ID; + int temperature; + private: I2C _i2c; char rx,tx[2],address; //I2C variables - char rawdata[16]; //Temporary array for input data values + char rawdata[22]; //Temporary array for input data values char op_mode; char pwr_mode; - float accel_scale,rate_scale,angle_scale,temp_scale; + float accel_scale,rate_scale,angle_scale; + int temp_scale; void readchar(char location){ tx[0] = location;