Pull request for i.a. sensor buffer template
Dependencies: BLE_API MPU6050 mbed nRF51822
Diff: main.cpp
- Revision:
- 4:aea4ff8e52ef
- Parent:
- 3:7875f062a4ea
- Child:
- 5:614164945894
--- a/main.cpp Tue Sep 18 19:44:58 2018 +0000 +++ b/main.cpp Wed Sep 19 18:24:52 2018 +0000 @@ -31,10 +31,10 @@ #define DEFAULT_MPU_HZ (100) -#define MANUFACTURER "ALTEN" -#define MODELNUMBER "IoT BLE (PM)" -#define SERIALNUMBER "serialnumber" -#define HARDWAREREVISION "demo1" +#define MANUFACTURER "PM @ ALTEN" +#define MODELNUMBER "IoT BLE" +#define SERIALNUMBER "123456" +#define HARDWAREREVISION "Seeed demo IoT" #define FIRMWAREREVISION "1.0" #define SOFTWAREREVISION "1.0" @@ -67,10 +67,6 @@ int16_t gx, gy, gz; -void check_i2c_bus(void); -unsigned short inv_orientation_matrix_to_scalar( const signed char *mtx); - - void connectionCallback(const Gap::ConnectionCallbackParams_t *params) { LOG("Connected!\n"); @@ -108,16 +104,6 @@ blue = !blue; } -void tap_cb(unsigned char direction, unsigned char count) -{ - LOG("Tap motion detected\n"); -} - -void android_orient_cb(unsigned char orientation) -{ - LOG("Oriention changed\n"); -} - int main(void) { @@ -195,12 +181,9 @@ batteryVoltageChanged = false; } else if (startMeasure == true) { - LOG("Start measuring the acceleration\n"); - - float a[3]; + float a[3]; mpu.getAccelero(a); - //writing current accelerometer and gyro position - LOG("%.2f;%.2f;%.2f\n", a[0], a[1], a[2]); + LOG("Acceleration %.2f;%.2f;%.2f\n", a[0], a[1], a[2]); startMeasure = false; float temp = mpu.getTemp(); @@ -209,50 +192,3 @@ } } -/* These next two functions converts the orientation matrix (see - * gyro_orientation) to a scalar representation for use by the DMP. - * NOTE: These functions are borrowed from Invensense's MPL. - */ -static inline unsigned short inv_row_2_scale(const signed char *row) -{ - unsigned short b; - - if (row[0] > 0) - b = 0; - else if (row[0] < 0) - b = 4; - else if (row[1] > 0) - b = 1; - else if (row[1] < 0) - b = 5; - else if (row[2] > 0) - b = 2; - else if (row[2] < 0) - b = 6; - else - b = 7; // error - return b; -} - -unsigned short inv_orientation_matrix_to_scalar( - const signed char *mtx) -{ - unsigned short scalar; - - /* - XYZ 010_001_000 Identity Matrix - XZY 001_010_000 - YXZ 010_000_001 - YZX 000_010_001 - ZXY 001_000_010 - ZYX 000_001_010 - */ - - scalar = inv_row_2_scale(mtx); - scalar |= inv_row_2_scale(mtx + 3) << 3; - scalar |= inv_row_2_scale(mtx + 6) << 6; - - - return scalar; -} -