Added BNO080Wheelchair.h
Dependents: BNO080_program wheelchaircontrol8 Version1-9 BNO080_program
Diff: BNO080Wheelchair.h
- Revision:
- 10:9275e6f7bf1b
- Parent:
- 9:a12af7cb3c6d
- Child:
- 11:dbe6d8d0ceb1
diff -r a12af7cb3c6d -r 9275e6f7bf1b BNO080Wheelchair.h --- a/BNO080Wheelchair.h Mon Jul 29 18:24:40 2019 +0000 +++ b/BNO080Wheelchair.h Tue Jul 30 18:33:45 2019 +0000 @@ -1,33 +1,39 @@ #ifndef BNO080Wheelchair_H #define BNO080Wheelchair_H -#include "filter.h" -#include "math.h" -#include <BNO080.h> +//#include "filter.h" +#include "math.h" +#include "BNO080.h" #define PI 3.141593 -#define SDA PB_9 -#define SCL PB_8 +#define SDA D4 +#define SCL D5 +#define INT_PIN D12 // Change once actually connected +#define RST_PIN D10 // Change once actually connected + #define SAMPLEFREQ 50 #define CAL_TIME 3 class BNO080Wheelchair { public: //The constructor for this class - BNO080(Serial* out, Timer* time); - BNO080(PinName sda_pin, PinName scl_pin, Serial* out, Timer* time); - + //BNO080Wheelchair(Serial* out, Timer* time); + //BNO080Wheelchair(PinName sda_pin, PinName scl_pin, Serial* out, Timer* time); + BNO080Wheelchair(Serial *debugPort, PinName sdaPin, + PinName sclPin, PinName intPin, PinName rstPin, + uint8_t i2cAddress, int i2cPortpeed); + //Set up the IMU, check if it connects void setup(); - //Get the x-component of the angular acceleration + //Get the x-component of the linear acceleration double accel_x(); - //Get the y-component of the angular acceleration + //Get the y-component of the linear acceleration double accel_y(); - //Get the z-component of the angular acceleration + //Get the z-component of the linear acceleration double accel_z(); //Get the x-component of gyro, angular velocity @@ -50,6 +56,9 @@ //Get the roll, the tilt double roll(); + + //Get angle from North + double compass(); BNO080* imu; //The IMU we're testing from, MPU6050 @@ -60,6 +69,9 @@ float gyroData[3]; // stores the gyro data x,y,z float* accelD; // pointer that points to either accelData float* gyroD; // ptr to the gyroData array + TVector3 gyroRotation; + TVector3 linearAcceleration; + TVector3 magField; float angleData[3]; // contains the pitch, roll, yaw angle float* angleD; // ptr to angleData array