Test with EzSbc2 LPC1347 board and Adafruit OLED 0,96" display, connected to i2c renamed from initial test 'mbed_blinky'

Dependencies:   Adafruit_GFX mbed

Revision:
0:e1e154fcc87e
Child:
3:671cc904fce6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 17 22:48:00 2014 +0000
@@ -0,0 +1,72 @@
+#include "mbed.h"
+#include "Adafruit_SSD1306.h"
+ 
+
+// modified für EzSBC2
+
+DigitalOut ledRed(P1_16);
+DigitalOut ledGreen(P1_15);
+
+// an SPI sub-class that provides a constructed default
+class SPI2 : public SPI
+{
+public:
+    SPI2(PinName mosi, PinName miso, PinName clk) : SPI(mosi,miso,clk)
+    {
+        format(8,3);
+        frequency(2000000);
+    };
+};
+ 
+// an I2C sub-class that provides a constructed default
+class I2C2 : public I2C
+{
+public:
+    I2C2(PinName sda, PinName scl) : I2C(sda, scl)
+    {
+        frequency(400000);
+        start();
+    };
+};
+ 
+
+I2C2 gI2C(P0_5, P0_4);
+Adafruit_SSD1306_I2c gOled2(gI2C, P0_21, 0x78, 64, 128);
+// Adafruit_SSD1306_I2c gOled2(gI2C, NC, 0x78, 64, 128);    // works only with mbed libs < version 86
+ 
+int main()
+{   
+    uint16_t x=0;
+ 
+    //while(1) 
+    {
+        ledRed = 1;
+        ledGreen = 0;
+        wait(0.5);
+
+        ledRed = 0;
+        ledGreen = 1;
+        wait(0.5);
+    }
+
+    gOled2.clearDisplay();
+    gOled2.display();
+
+    //gOled2.setTextCursor(1, 0);
+    gOled2.printf("%ux%u OLED Display\r\n", gOled2.width(), gOled2.height());
+    
+    while(1)
+    {
+        ledRed = !ledRed;
+        
+        gOled2.setTextCursor(0, 10);
+        gOled2.printf("%u\r", x);
+        gOled2.display();
+        
+        x++;
+        wait(1.0);
+    }
+// AnalogOut sine(PA_4);
+
+   
+}