dash v6

Dependencies:   mbed

Fork of DashboardV4 by Mark Bruijn

Revision:
17:f8d3d1f0d8d1
Parent:
16:21658c9e697c
--- a/oled_driver.h	Tue May 02 17:25:18 2017 +0000
+++ b/oled_driver.h	Sun May 21 19:33:42 2017 +0000
@@ -1,19 +1,21 @@
 #include "oled_characters.h"    //all OLED chars + logos
 
 #define PI 3.141592
-#define SPI_FREQUENCY 9000000
+#define SPI_FREQUENCY 5000000
 
 //digital outputs and SPI
-SPI spi(D11, NC, D13);                      //mosi, miso, sclk
-DigitalOut RST(D3);                         //reset                             0: reset        1: normal operation
-DigitalOut DC(D2);                          //set input as data or command      0: command      1: data
-DigitalOut CS_1(D8);                        //chipSelect 1                      0: selected     1: not selected
-DigitalOut CS_2(D9);                        //chipSelect 2                      0: selected     1: not selected
-DigitalOut CS_3(D10);                       //chipSelect 3                      0: selected     1: not selected
-DigitalOut motor_temp_alert_led(D5);        //
-DigitalOut battery_temp_alert_led(D4);      //
-DigitalOut battery_low_alert_led(D6);       //
-DigitalOut fly_ready_led(D7);               //
+SPI spi(PB_15, NC, PB_13);     // mosi, miso, sclk
+DigitalOut RST(PB_12);         //reset                             0: reset        1: normal operation
+DigitalOut DC(PA_10);          //set input as data or command      0: command      1: data
+
+DigitalOut battery_temp_alert_led(PC_1);
+DigitalOut motor_temp_alert_led(PA_8);
+DigitalOut battery_low_alert_led(PB_10);
+DigitalOut fly_ready_led(PB_0);
+
+DigitalOut CS_1(PB_3);        //chipSelect                        0: selected     1: not selected
+DigitalOut CS_2(PB_5);        //chipSelect                        0: selected     1: not selected
+DigitalOut CS_3(PB_4);        //chipSelect                        0: selected     1: not selected
 
 bool error_alert;                           //internal error booleaan
 
@@ -287,7 +289,7 @@
         if (battery_temp_alert) amount_of_errors++;
         if (battery_low_alert) amount_of_errors++;
     }
-
+    /*
     //if in error screen display ALL errors
     if (current_menu == 1) {
         writeLetter(2, 'E', 66, 59);
@@ -314,10 +316,10 @@
             amount_of_errors++;
         }
         //if (error_alert) {
-//            writeLetter(2, 'E', 57 - (10*amount_of_errors), 59);
-//            writeNumber(2, 4, 57 - (10*amount_of_errors), 55, 1, false);
-//            amount_of_errors++;
-//        }
+    //            writeLetter(2, 'E', 57 - (10*amount_of_errors), 59);
+    //            writeNumber(2, 4, 57 - (10*amount_of_errors), 55, 1, false);
+    //            amount_of_errors++;
+    //        }
 
         for (int j = amount_of_errors; j <= 25; j++) {
             if (j < 6) {
@@ -325,9 +327,9 @@
                 writeLetter(2, ' ', 57 - (10*j), 55);
             }
             //else if (j > 5 && j < 11) writeLetter(2, ' ', 64 - (10*(j-5)), 47);
-//        else if (j > 10 && j < 16) writeLetter(2, ' ', 64 - (10*(j-10)), 35);
-//        else if (j > 15 && j < 21) writeLetter(2, ' ', 64 - (10*(j-15)), 23);
-//        else if (j > 20 && j < 26) writeLetter(2, ' ', 64 - (10*(j-20)), 11);
+    //        else if (j > 10 && j < 16) writeLetter(2, ' ', 64 - (10*(j-10)), 35);
+    //        else if (j > 15 && j < 21) writeLetter(2, ' ', 64 - (10*(j-15)), 23);
+    //        else if (j > 20 && j < 26) writeLetter(2, ' ', 64 - (10*(j-20)), 11);
         }
 
         if (amount_of_errors < 1) {
@@ -347,7 +349,7 @@
     } else if (current_menu == 0 && !error_alert) {
         //clear if no errors
         drawBitmap(2, 92, 64, 48, 7, 10);
-    }
+    } */
 }
 
 void showBatteryMinutesLeft(int battery_minutes_left)
@@ -454,18 +456,18 @@
 
 void displayAdvisedThrottle(int advised_throttle_power)
 {
-    writeNumber(2, advised_throttle_power, 41, 31, 4, false);
-    writeLetter(2, 'r', 41, 21);
-    writeLetter(2, 'p', 41, 17);
-    writeLetter(2, 'm', 41, 13);
+//    writeNumber(2, advised_throttle_power, 41, 31, 4, false);
+//    writeLetter(2, 'r', 41, 21);
+//    writeLetter(2, 'p', 41, 17);
+//    writeLetter(2, 'm', 41, 13);
 }
 
 void displayThrottle(int throttle_power, bool reverse)
 {
-    writeNumber(2, throttle_power, 50, 31, 4, false);
-    writeLetter(2, 'r', 50, 21);
-    writeLetter(2, 'p', 50, 17);
-    writeLetter(2, 'm', 50, 13);
+    writeNumber(2, throttle_power, 45, 31, 4, false);
+    writeLetter(2, 'r', 45, 21);
+    writeLetter(2, 'p', 45, 17);
+    writeLetter(2, 'm', 45, 13);
 
     if (reverse) {
         writeLetter(2, 'R', 15, 31);
@@ -519,11 +521,11 @@
 {
     if (velocity < 1) velocity = 0;
 
-    writeNumber(2, velocity, 32, 31, 3, false);
-    writeLetter(2, 'k', 32, 21);
-    writeLetter(2, 'm', 32, 17);
-    writeLetter(2, '/', 32, 13);
-    writeLetter(2, 'h', 32, 9);
+    writeNumber(2, velocity, 35, 31, 3, false);
+    writeLetter(2, 'k', 35, 21);
+    writeLetter(2, 'm', 35, 17);
+    writeLetter(2, '/', 35, 13);
+    writeLetter(2, 'h', 35, 9);
 }
 
 void writeLetter(int screen_number, char input, int row, int col)