Modify I2C class in main.cpp

Dependencies:   Adafruit_GFX mbed

Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by IOP

Files at this revision

API Documentation at this revision

Comitter:
WIzMatthew
Date:
Mon Apr 17 01:34:36 2017 +0000
Parent:
11:f4ecb5faeffe
Commit message:
Modify I2C Class in main.cpp

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Feb 03 07:37:35 2016 +0000
+++ b/main.cpp	Mon Apr 17 01:34:36 2017 +0000
@@ -3,26 +3,20 @@
 
 DigitalOut myled_R(LED_RED);
 
-// SPI sub-class that provides a constructed default
-class I2CPreInit : public I2C
-{
-public:
-    I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl)
-    {
-        frequency(100000);
-        start();
-    };
-};
+I2C i2c(PA_10,PA_9);
 
-I2CPreInit myI2C(PA_10,PA_9);
-Adafruit_SSD1306_I2c myOled(myI2C,NC,0x78,64,128);
+Adafruit_SSD1306_I2c myOled(i2c,NC,0x78,64,128);
+
 
 int main()
 {   
+    //i2c.frequency(100000);
+    i2c.start();
+
     uint16_t x=0;
  
     myOled.begin();
-    myOled.printf("%ux%u Hellow World\r\n", myOled.width(), myOled.height());
+    myOled.printf("%ux%u \nHellow World\r\n", myOled.width(), myOled.height());
     myOled.display();
 
     while(1)
--- a/mbed.bld	Wed Feb 03 07:37:35 2016 +0000
+++ b/mbed.bld	Mon Apr 17 01:34:36 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10
\ No newline at end of file