CSE477 / swimate_v2

Dependencies:   Adafruit_GFX_128x64 DS3231 PinDetect SDFileSystem USBDevice mbed RealtimeMath MODSERIAL

Revision:
21:2fa676f214fe
Parent:
8:8430a5c0914c
Child:
22:9350752f5414
--- a/main.h	Thu Jun 05 19:03:42 2014 +0000
+++ b/main.h	Sat Jun 07 07:12:25 2014 +0000
@@ -1,11 +1,22 @@
+#ifndef _MAIN_H
+#define _MAIN_H
+
 #define SYNC_HOLD_TIME_MS 1000
 #define DEBOUNCE_TIME_MS 200
 
-#define USE_OLED
+#include "Adafruit_SSD1306.h"
+
+// #define USE_OLED
 #ifdef USE_OLED
+
+    extern SPI spi0; // mosi, miso, sclk
+    extern Adafruit_SSD1306 oled; // DC, RST, CS
+
     #define OLED_SETCURS(xpos,ypos) oled.setCursor(xpos,ypos);
     #define OLED_CLEAR() oled.clearDisplay();
     
+    #define OLED_DRAWPIXEL(x,y,color) oled.drawPixel(x, y, color);
+    
     #define OLED_PRINT(x) oled.printf("%s", x); oled.display();
     #define OLED_PRINTF(x,y) oled.printf(x, y); oled.display();
     #define OLED_PRINTLN(x) oled.printf("%s\r\n", x); oled.display();
@@ -22,7 +33,10 @@
     #define OLED_PRINTPFR(x,y,xpos,ypos) oled.setCursor(xpos,ypos); oled.printf(x,y); oled.printf("\r"); oled.display();
 #else
     #define OLED_SETCURS(xpos,ypos)
-
+    #define OLED_CLEAR()
+    
+    #define OLED_DRAWPIXEL(x, y, color)
+    
     #define OLED_PRINT(x)
     #define OLED_PRINTF(x,y)
     #define OLED_PRINTLN(x)
@@ -37,4 +51,6 @@
     #define OLED_PRINTPLNF(x,y,xpos,ypos)
     #define OLED_PRINTPR(x,xpos,ypos)
     #define OLED_PRINTPFR(x,y,xpos,ypos)
-#endif
\ No newline at end of file
+#endif
+
+#endif // _MAIN_H
\ No newline at end of file