Test with EzSbc2 LPC1347 board and Adafruit 0,96" display, connected to i2c

Dependencies:   Adafruit_GFX I2CDevLib MPU9150 SmallGUI USBDevice WeeESP8266 mbed nRF24L01P

Files at this revision

API Documentation at this revision

Comitter:
JojoS
Date:
Mon Nov 17 22:48:00 2014 +0000
Child:
1:6ba1660b2ea2
Commit message:
Test program for Adafruit SS1306 display, running on a LPC1347 target

Changed in this revision

Adafruit_GFX.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.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Adafruit_GFX.lib	Mon Nov 17 22:48:00 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/JojoS/code/Adafruit_GFX/#7fb1d4d3525d
--- /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);
+
+   
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Mon Nov 17 22:48:00 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#031413cf7a89