test fork

Dependencies:   SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed

Fork of CANary_9341 by Tick Tock

Revision:
13:62e0f7f39ff5
Parent:
12:8e42d7ba8468
Child:
15:a359fecf85ba
--- a/main.cpp	Sun Mar 03 15:50:54 2013 +0000
+++ b/main.cpp	Sun Mar 03 17:06:12 2013 +0000
@@ -1,5 +1,5 @@
-//#include "utility.h"
-//#include "displayModes.h"
+// main.cpp
+
 //To Do:
 // * USB device detect
 // * config file on local fs with touchscreen calibration
@@ -10,6 +10,7 @@
 // * auto-poll option for cellpair data
 // * cellpair histogram
 // * 
+
 #include "mbed.h"
 #include "CAN.h"
 #include "beep.h"
@@ -19,6 +20,56 @@
 #include "utility.h"
 #include "displayModes.h"
 
+LocalFileSystem local("local");
+
+// to write to USB Flash Drives, or equivalent (SD card in Reader/Writer)
+MSCFileSystem fs("fs"); // to write to a USB Flash Drive
+
+time_t seconds ;
+Beep spkr(p21);
+
+Ticker ticker;
+Timer timer;
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+PwmOut dled(p24);
+
+InterruptIn touchpad(p17);
+CAN can1(p9, p10);      // CAN1 (EV) uses pins 9 and 10 (rx, tx) and pin 8 (rs)
+DigitalOut can1SleepMode(p8);     // Use pin 8 to control the sleep mode of can2
+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
+
+TOUCH_TFTx2 tt(p16, p17, p19, p20, p11, p12, p13, p6, p7, p5, "TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs0, cs1, reset
+
+bool logEn = true,logOpen = false;
+FILE *rfile;
+FILE *file;
+char fileName[35] = "" ;
+char writeBuffer[maxBufLen][13]; // buffer for USB write
+char indexLastMsg[0x800]={0}; // index table for last message
+CANMessage lastMsg[100]; // table to store last message of eachtype
+unsigned char battData[256]={0};
+unsigned char msgChanged[100]; // inidcates which bytes changed
+char c;
+volatile int writePointer = 0;
+volatile int secsNoMsg = 0, secsNoTouch = 0;
+volatile bool canIdle = false, userIdle = false;
+bool touched=0; //flag to read touchscreen
+char counter = 0;
+unsigned char dMode[2] = {7,2}; //display mode
+unsigned char sMode = 0; // setup mode
+unsigned char lastDMode[2] = {0,0}; //last screen mode
+char displayLog[20][40];
+unsigned char displayLoc = 0;
+unsigned char indexOffset = 1;
+bool showCP = false;
+bool pollCP = false;
+
 int main() {
     int readPointer=0;
     char sTemp[40];