irira=

Dependencies:   Adafruit_GFX mbed

Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by IOP

Files at this revision

API Documentation at this revision

Comitter:
number_key
Date:
Tue Feb 21 09:46:42 2017 +0000
Parent:
11:f4ecb5faeffe
Commit message:
irita

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f4ecb5faeffe -r d5fa8cb51bc0 main.cpp
--- a/main.cpp	Wed Feb 03 07:37:35 2016 +0000
+++ b/main.cpp	Tue Feb 21 09:46:42 2017 +0000
@@ -4,18 +4,18 @@
 DigitalOut myled_R(LED_RED);
 
 // SPI sub-class that provides a constructed default
-class I2CPreInit : public I2C
+class SPIPreInit : public SPI
 {
 public:
-    I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl)
+    SPIPreInit(PinName mosi, PinName miso, PinName clk) : SPI(mosi,miso,clk)
     {
-        frequency(100000);
-        start();
+        format(8,3);
+        frequency(2000000);
     };
 };
 
-I2CPreInit myI2C(PA_10,PA_9);
-Adafruit_SSD1306_I2c myOled(myI2C,NC,0x78,64,128);
+SPIPreInit gSpi(dp5,NC,dp6);
+Adafruit_SSD1306_Spi myOled(gSpi,dp2,dp3,dp4);
 
 int main()
 {   
@@ -28,9 +28,9 @@
     while(1)
     {
         myled_R = !myled_R;
-        myOled.printf("%u\r",x);
+        myOled.printf("%Irita=%u\r",x);
         myOled.display();
         x = x + 1;                  
-        wait(1.0);
+        //wait(1.0);
     }
 }