Working Version Of OLED
Dependencies: Adafruit_GFX mbed
Revision 0:a886e44467c7, committed 2016-04-21
- Comitter:
- ipv1
- Date:
- Thu Apr 21 08:04:16 2016 +0000
- Commit message:
- Initial Working Commit for Atmel OLED
Changed in this revision
diff -r 000000000000 -r a886e44467c7 Adafruit_GFX.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adafruit_GFX.lib Thu Apr 21 08:04:16 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/nkhorman/code/Adafruit_GFX/#7fb1d4d3525d
diff -r 000000000000 -r a886e44467c7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 21 08:04:16 2016 +0000 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2012 Neal Horman - http://www.wanlink.com + * + * License: MIT open source (http://opensource.org/licenses/MIT) + * Summary; + * Use / modify / distribute / publish it how you want and + * if you use it, or don't, you can't hold me liable for how + * it does or doesn't work. + * If it doesn't work how you want, don't use it, or change + * it so that it does work. + */ + +#include "mbed.h" +#include "Adafruit_SSD1306.h" + +DigitalOut myled(LED1); + +// an SPI sub-class that provides a constructed default +class SPIPreInit : public SPI +{ +public: + SPIPreInit(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 I2CPreInit : public I2C +{ +public: + I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl) + { + frequency(400000); + start(); + }; +}; + +SPIPreInit gSpi(PA_8,PA_7,PA_6); +Adafruit_SSD1306_Spi gOled1(gSpi,PC_6,PA_0,PA_5); + + +int main() +{ uint16_t x=0; + + gOled1.printf("%ux%u OLED Display\r\n", gOled1.width(), gOled1.height()); + + while(1) + { + myled = !myled; + gOled1.printf("%u\r",x); + gOled1.display(); + x++; + wait(1.0); + } +} \ No newline at end of file
diff -r 000000000000 -r a886e44467c7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 21 08:04:16 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file