mbed support for STM32F103C8T6 (Blue Pill) boards
Diff: peripherals/oled.cpp
- Revision:
- 14:900adc64ed43
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/peripherals/oled.cpp Fri Sep 28 13:28:09 2018 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" +#include "Adafruit_SSD1306.h" + +I2C *i2c_oled; +Adafruit_SSD1306_I2c *oled_disp; + +void initOLED(void) { + i2c_oled = new I2C(PB_9, PB_8); + oled_disp = new Adafruit_SSD1306_I2c(*i2c_oled, PB_7); +} + +void testOLED(void) { + oled_disp->clearDisplay(); + oled_disp->splash(); + oled_disp->display(); + oled_disp->clearDisplay(); + oled_disp->splash(); + oled_disp->display(); + wait(2.0); + oled_disp->clearDisplay(); + oled_disp->display(); + oled_disp->setTextCursor(0,8); + oled_disp->printf("Hello, world!"); + oled_disp->setTextCursor(0,16); + oled_disp->printf("--------"); + oled_disp->setTextCursor(0,24); + oled_disp->printf("Goodbye!"); + oled_disp->display(); + wait(1.0); + oled_disp->clearDisplay(); + oled_disp->display(); + oled_disp->setTextCursor(0,8); + oled_disp->printf("OLED TESTING COMPLETE"); + oled_disp->display(); +} \ No newline at end of file