SSD1306 LCD 96x16 model
Dependents: testSoftware8_alles_display
Fork of ssd1306_library by
Diff: ssd1306.h
- Revision:
- 3:bb6fba3e84ff
- Parent:
- 2:7f1160c1a741
- Child:
- 4:35757c8b7625
diff -r 7f1160c1a741 -r bb6fba3e84ff ssd1306.h --- a/ssd1306.h Thu Oct 26 16:07:21 2017 +0000 +++ b/ssd1306.h Wed Nov 01 11:04:20 2017 +0000 @@ -1,9 +1,14 @@ /* -* ssd1306.cpp +* ssd1306.h * * Created on: 20 oct. 2017 -* Author: rodriguj +* Author: Miguel Angel Rodriguez Jodar +* +* Based upon Adafruit library. +* GPL licensed. +* */ + #ifndef MBED_SSD1306_LIBRARY #define MBED_SSD1306_LIBRARY @@ -75,12 +80,19 @@ Fast }; - /** Crea una interfaz al display OLED usando el bus I2C + /** Creates an instance of a SSD1306 driver, specifying I2C pins to use * * @param sda I2C data line pin * @param scl I2C clock line pin */ - SSD1306 (PinName sda, PinName scl); + SSD1306 (PinName sda, PinName scl, char ssd1306_addr = 0x78); + + /** Creates an instance of a SSD1306 driver using an existing I2C object + * + * @param busi2c I2C object + * @param ssd1306_addr I2C addr of SSD1306 controller + */ + SSD1306 (I2C &busi2c, char ssd1306_addr = 0x78); /** Set the frequency of the I2C interface * @@ -95,6 +107,8 @@ void putchar (char c, bool refresh=false); void puts (char *s, bool refresh=false); + + void printf (char *fmt,...); void locate (char row, char column); @@ -106,10 +120,15 @@ void plot (char x, char y, PlotStyle modo, bool refresh=false); + bool point (char x, char y); + void line (char x0, char y0, char x1, char y1, PlotStyle modo, bool refresh=false); + void circle (char x0, char y0, char r, PlotStyle modo, bool refresh=false); + virtual ~SSD1306 () { - delete bus; + if (!do_not_delete_bus) + delete bus; delete fb; } @@ -117,6 +136,7 @@ I2C *bus; char ssd1306_i2c_addr; char *fb; + char do_not_delete_bus; int idxfb; int command (char c); int data (char d); @@ -126,4 +146,3 @@ }; #endif -