Removed sd card logging code; started proces of updating to work with DUE as well as mega

This commit is contained in:
Mike C 2013-04-27 14:57:28 -04:00
parent 182c6f9c23
commit 2558981f76
4 changed files with 39 additions and 20 deletions

View file

@ -238,13 +238,13 @@ void Config::processSerialData() {
int inByte = serialPort3.read(); int inByte = serialPort3.read();
serialPort0.write(inByte); serialPort0.write(inByte);
ui->blinkCancelButton(); ui->blinkCancelButton();
dataFile.print(inByte); //dataFile.print(inByte);
} }
if (serialPort0.available()) { if (serialPort0.available()) {
int inByte = serialPort0.read(); int inByte = serialPort0.read();
serialPort3.write(inByte); serialPort3.write(inByte);
ui->blinkOKButton(); ui->blinkOKButton();
dataFile.print(inByte); //dataFile.print(inByte);
} }
break; break;
case 1: // db9_null case 1: // db9_null
@ -252,13 +252,13 @@ void Config::processSerialData() {
int inByte = serialPort2.read(); int inByte = serialPort2.read();
serialPort0.write(inByte); serialPort0.write(inByte);
ui->blinkCancelButton(); ui->blinkCancelButton();
dataFile.print(inByte); //dataFile.print(inByte);
} }
if (serialPort0.available()) { if (serialPort0.available()) {
int inByte = serialPort0.read(); int inByte = serialPort0.read();
serialPort2.write(inByte); serialPort2.write(inByte);
ui->blinkOKButton(); ui->blinkOKButton();
dataFile.print(inByte); //dataFile.print(inByte);
} }
break; break;
case 2: // cisco case 2: // cisco
@ -266,17 +266,17 @@ void Config::processSerialData() {
int inByte = serialPort1.read(); int inByte = serialPort1.read();
serialPort0.write(inByte); serialPort0.write(inByte);
ui->blinkCancelButton(); ui->blinkCancelButton();
dataFile.print(inByte); //dataFile.print(inByte);
} }
if (serialPort0.available()) { if (serialPort0.available()) {
int inByte = serialPort0.read(); int inByte = serialPort0.read();
serialPort1.write(inByte); serialPort1.write(inByte);
ui->blinkOKButton(); ui->blinkOKButton();
dataFile.print(inByte); //dataFile.print(inByte);
} }
break; break;
} }
// Flush data written to log file // Flush data written to log file
dataFile.sync(); //dataFile.sync();
} }

View file

@ -15,6 +15,9 @@
#define DEBUG 1 // NONE = 0; MINIMAL = 1; FULL = 2; #define DEBUG 1 // NONE = 0; MINIMAL = 1; FULL = 2;
// Whether or not the Arduino Mega 2560 is used as the base board
#define ARD_MEGA_2560 true
// Buttons / Joystick / Input Hardware Pinouts // Buttons / Joystick / Input Hardware Pinouts
#define okButtonPin 22 #define okButtonPin 22
#define okButtonLed 23 #define okButtonLed 23
@ -54,10 +57,17 @@
#define FONT_HEIGHT 8 #define FONT_HEIGHT 8
// Serial ports // Serial ports
extern SerialPort<0, 4096, 0> serialPort0; #if ARD_MEGA_2560
extern SerialPort<0, 4096, 0> serialPort1; extern SerialPort<0, 512, 512> serialPort0;
extern SerialPort<0, 4096, 0> serialPort2; extern SerialPort<1, 512, 512> serialPort1;
extern SerialPort<0, 4096, 0> serialPort3; extern SerialPort<2, 512, 512> serialPort2;
extern SerialPort<3, 512, 512> serialPort3;
#else
extern SerialPort<0, 4096, 4096> serialPort0;
extern SerialPort<1, 4096, 4096> serialPort1;
extern SerialPort<2, 4096, 4096> serialPort2;
extern SerialPort<3, 4096, 4096> serialPort3;
#endif
// Serial modes supported // Serial modes supported
// Abused in for loops / lookup tables -- DO NOT CHANGE none or set values // Abused in for loops / lookup tables -- DO NOT CHANGE none or set values

View file

@ -18,9 +18,10 @@
#include "UIJoystickPSP.h" #include "UIJoystickPSP.h"
UILCD::UILCD() { UILCD::UILCD() {
#if DEBUG == 2 #if DEBUG == 2
serialPort0.println("UILCD::UILCD()"); serialPort0.println("UILCD::UILCD()");
#endif #endif
pinMode(LCD_LITE, OUTPUT); pinMode(LCD_LITE, OUTPUT);
tft = new Adafruit_ST7735(LCD_CS, LCD_DC, LCD_RST); tft = new Adafruit_ST7735(LCD_CS, LCD_DC, LCD_RST);
@ -496,7 +497,7 @@ void UILCD::bmpDraw(char *filename, uint8_t x, uint8_t y) {
return; return;
} }
#if DEBUG == 2 #if DEBUG == 1
serialPort0.println(); serialPort0.println();
serialPort0.print("Loading image '"); serialPort0.print("Loading image '");
serialPort0.print(filename); serialPort0.print(filename);
@ -505,7 +506,8 @@ void UILCD::bmpDraw(char *filename, uint8_t x, uint8_t y) {
// Open requested file on SD card // Open requested file on SD card
if (!bmpFile.open(filename)) { if (!bmpFile.open(filename)) {
serialPort0.print("File not found"); serialPort0.print(filename);
serialPort0.println(" not found");
return; return;
} }

View file

@ -33,10 +33,17 @@ Config* config;
RTC_DS1307 rtc; RTC_DS1307 rtc;
SdFat sd; SdFat sd;
SdFile dataFile; SdFile dataFile;
SerialPort<0, 4096, 0> serialPort0; #if ARD_MEGA_2560
SerialPort<0, 4096, 0> serialPort1; SerialPort<0, 512, 512> serialPort0;
SerialPort<0, 4096, 0> serialPort2; SerialPort<1, 512, 512> serialPort1;
SerialPort<0, 4096, 0> serialPort3; SerialPort<2, 512, 512> serialPort2;
SerialPort<3, 512, 512> serialPort3;
#else
SerialPort<0, 4096, 4096> serialPort0;
SerialPort<1, 4096, 4096> serialPort1;
SerialPort<2, 4096, 4096> serialPort2;
SerialPort<3, 4096, 4096> serialPort3;
#endif
// helper for interrupt method call // helper for interrupt method call
void processSerial() { void processSerial() {