Works

Dependencies:   BMP180 BNO055_fusion Fonts GPSISR HTU21D SDFileSystem UniGraphic mbed uGUI

Fork of Bicycl_Computer_NUCLEO-F411RE by Darren Ulrich

Revision:
6:6eb4b9322931
Parent:
4:25554dc066a0
Child:
7:b78ff34209e5
diff -r 25554dc066a0 -r 6eb4b9322931 main.cpp
--- a/main.cpp	Sat Dec 17 19:36:21 2016 +0000
+++ b/main.cpp	Thu Jan 19 20:46:26 2017 +0000
@@ -23,21 +23,15 @@
 #include <math.h>
 #include "ILI9341.h"
 #include "SeeedStudioTFTv2.h"
-//#include "SPI_STMPE610.h"
+#include "BNO055.h"
+#include "HTU21D.h"
+#include "BMP180.h"
+
 #include "Arial12x12.h"
 #include "Arial24x23.h"
 #include "Arial28x28.h"
 #include "Arial43x48_numb.h"
 
-/*
-#define PIN_MOSI        PA_7
-#define PIN_MISO        PA_6  
-#define PIN_SCLK        PA_5 
-#define PIN_CS_TFT      PB_6 
-#define PIN_DC_TFT      PC_7 
-#define PIN_BL_TFT      PA_8 
-#define PIN_CS_SD       PB_5 
-*/
 #define PIN_CS_TSC      PA_9 
 #define PIN_TSC_INTR    PA_8
 #define PIN_RESET_TFT   PC_13 /* place holder */
@@ -51,8 +45,15 @@
 #define PIN_SCLK        D13
 #define PIN_CS_TFT      D5
 #define PIN_DC_TFT      D6
-#define PIN_BL_TFT      D7
 #define PIN_CS_SD       D4
+#define PIN_RESET       D7
+
+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;
 
 #define DEVICE_NAME     "F411RE"
 
@@ -60,17 +61,27 @@
 #define TARGET_NECLEO_F411RE 
 #endif
 
+DigitalOut backlight(PB_3) ;
+// DigitalOut tsc_cs(PA_9, 1) ;
+// DigitalOut tft_cs(PB_6, 1) ;
 
-DigitalOut backlight(PB_3) ;
-DigitalOut tsc_cs(PA_9, 1) ;
-DigitalOut tft_cs(PB_6, 1) ;
-
+// Display
 ILI9341 TFT(SPI_8, 10000000, 
     PIN_MOSI, PIN_MISO,  PIN_SCLK, 
     PIN_CS_TFT, PIN_RESET_TFT, PIN_DC_TFT, "Adafruit2.8") ;
-//SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
+    
+// TouchScreen
 TouchScreen TSC(PIN_XP, PIN_XM, PIN_YP, PIN_YM);
 
+// 3 Axis IMU
+BNO055 imu(i2c, PIN_RESET);  // Reset =D7, addr = BNO055_G_CHIP_ADDR, mode = MODE_NDOF <- as default
+
+// Humidity and Temperature
+HTU21D temphumid(I2C_SDA, I2C_SCL);
+
+// Pressure
+BMP180 bmp180; // initialize BMP-180 altimeter
+
 int page = 0 ;
 int numPage = 2 ;
 
@@ -210,29 +221,29 @@
     
 int main()
 {
-    uint16_t x, y, z ;
+    // uint16_t x, y, z ;
     int prevPage = 99 ;
     bool waitTouch = false ;
     point p;
     
     printf("Hello World\n") ;
     
-    //tsc_cs = 1 ;
-    tft_cs = 0 ;
-    //initTFT() ;
-    tft_cs = 1 ;
+    // tsc_cs = 1 ;
+    // tft_cs = 0 ;
+    // initTFT() ;
+    // tft_cs = 1 ;
 
-    //tsc_cs = 0 ;
-    //TSC.spi_format(8, 1) ; // for Nucleo F411RE
-    //tsc_cs = 1 ;
+    // tsc_cs = 0 ;
+    // TSC.spi_format(8, 1) ; // for Nucleo F411RE
+    // tsc_cs = 1 ;
     
- //   screen0() ;
+    // screen0() ;
         
     printf("Program Started!\n\r") ;
     
     for(;;) {
 //        printf("TFT width = %d, height = %d\n\r", TFT.width(), TFT.height()) ;
-        tft_cs = 0 ;
+        // tft_cs = 0 ;
         switch(page) {
         case 0:
             if (prevPage != page) {
@@ -252,7 +263,7 @@
         }
         prevPage = page ;
 
-        tft_cs = 1 ;
+        // tft_cs = 1 ;
         do {
             TSC.getTouch(p);
             printf("Touched X %d\n\r", p.x) ;