Tick Tock / Mbed 2 deprecated CANary

Dependencies:   SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2_ILI9341 mbed

Fork of CANary_corrupt by Tick Tock

Files at this revision

API Documentation at this revision

Comitter:
TickTock
Date:
Sun May 18 13:02:18 2014 +0000
Parent:
185:f45e18d7b801
Child:
189:f566191877e4
Commit message:
Added support for new display controller; Added LED dim adjustment

Changed in this revision

SPI_TFTx2.lib Show diff for this revision Revisions of this file
SPI_TFTx2_w9341.lib Show annotated file Show diff for this revision Revisions of this file
TOUCH_TFTx2.lib Show diff for this revision Revisions of this file
TOUCH_TFTx2_w9341.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/SPI_TFTx2.lib	Sat May 17 13:29:40 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/TickTock/code/SPI_TFTx2/#11d7980e7e1c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SPI_TFTx2_w9341.lib	Sun May 18 13:02:18 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/TickTock/code/SPI_TFTx2_ILI9341/#aca12a61d2b1
--- a/TOUCH_TFTx2.lib	Sat May 17 13:29:40 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/TickTock/code/TOUCH_TFTx2/#f2165aa0daa6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOUCH_TFTx2_w9341.lib	Sun May 18 13:02:18 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/TickTock/code/TOUCH_TFTx2/#bee053b17977
--- a/main.cpp	Sat May 17 13:29:40 2014 +0000
+++ b/main.cpp	Sun May 18 13:02:18 2014 +0000
@@ -10,8 +10,11 @@
 // * Add on screen messages for heater on, etc, and use refresh feature above to clear in x seconds
 // * Be more efficient with write buffer (use msgLen instead of always storing 8 bytes)
 // * Merge in 9341 controller option
-// rev184
-// Fixed wh adjustment algorithm
+// rev188
+// Added support for new controller with pre-compiler directive
+
+// Include this before other header files
+#include "precompile.h"
 
 #include "mbed.h"
 #include "CAN.h"
@@ -22,7 +25,7 @@
 #include "displayModes.h"
 #include "TOUCH_TFTx2.h"
 
-char revStr[7] = "184";
+char revStr[7] = "188";
 unsigned long maxTarget = 1000;
 FATFS USBdrive;
 LocalFileSystem local("local");
@@ -49,7 +52,12 @@
 CAN can2(p30, p29);     // CAN2 (CAR) uses pins 30 and 29 (rx, tx) and pin 28 (rs)
 DigitalOut can2SleepMode(p28);     // Use pin 28 to control the sleep mode of can1
 AnalogIn mon12V(p15);
+#if USE_ILI9341 == 1
+TOUCH_TFTx2 tt(p16, p17, p19, p20, p11, p12, p13, p6, p7, p5, p14, "TFT"); // x+, x-, y+, y-, mosi, miso, sclk, cs0, cs1, reset, dc
+#else
 TOUCH_TFTx2 tt(p16, p17, p19, p20, p11, p12, p13, p6, p7, p5, "TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs0, cs1, reset
+#endif
+//TOUCH_TFTx2 tt(p16, p17, p19, p20, p11, p12, p13, p6, p7, p5, "TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs0, cs1, reset
 PwmOut dled(p23);
 PwmOut spkr(p21);
 
@@ -68,6 +76,7 @@
 bool lHeaterOn = false;
 bool CCon = false;
 bool lCCon = false;
+bool checkFWupdate = true;
 
 FILE *hfile; // history file
 FIL efile; // external usb file
@@ -201,9 +210,6 @@
     tt.set_font((unsigned char*) Arial12x12_prop);  // select the font
     tt.locate(0,0);
     tt.claim(stdout);        // send stdout to the TFT display
-    if(tt.is_touched()){ // If touching screen on poweron then update firmware
-        updateFirmware();
-    }
     touchpad.rise(&touch_ISR);
     tt.wfi();               // enable interrupt on touch
     dled.period(0.001);
@@ -818,6 +824,12 @@
 
         if(tick){ // Executes once a second
             tick=false;
+            if(checkFWupdate){
+                if(tt.is_touched()){ // If touching screen on poweron then update firmware
+                    updateFirmware();
+                }
+                checkFWupdate=false; // Only check once at first poweron
+            }
             lCCon = CCon;
             CCkW = (lastMsg[indexLastMsg[0x510]].data[3]&0x7f)*0.125;
             if(lastMsg[indexLastMsg[0x510]].data[3]&0x80){
--- a/mbed.bld	Sat May 17 13:29:40 2014 +0000
+++ b/mbed.bld	Sun May 18 13:02:18 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6
\ No newline at end of file