SSD1306 display library for the ESP8266 board
Posted:
Mon May 25, 2015 1:50 pm
by Somhi
SSD1306 display library for the ESP8266 board (modified from Adafruit_SSD1306)
This ESP_SSD1306 library is a copy of the Adafruit_SSD1306 library with some modifications in order to work with the ESP8266 board.
https://github.com/somhi/ESP_SSD1306Somhi
P.S. I'm kind of new to coding and github.
Re: SSD1306 display library for the ESP8266 board
Posted:
Mon Jun 01, 2015 5:26 am
by irukandji
Thank you for this! I'l be testing this lib as soon as i can (i've been waiting for someone to port it)
Re: SSD1306 display library for the ESP8266 board
Posted:
Fri Jun 05, 2015 2:30 pm
by squix78
Which type of screens does this library support. Does it work with the I2C 4-pin version?
Re: SSD1306 display library for the ESP8266 board
Posted:
Tue Jun 23, 2015 12:41 am
by Stoney
I have these same mods functioning on an ESP01 with the 4 pin I2C version.
I did not notice any changes to the Adafruit_SSD1306.h file ..
I also changed the top of the .h file to read .. (around line 27)
#ifdef ESP8266
typedef volatile uint32_t PortReg;
typedef uint32_t PortMask;
#else
#ifdef __SAM3X8E__
typedef volatile RwReg PortReg;
typedef uint32_t PortMask;
#else
typedef volatile uint8_t PortReg;
typedef uint8_t PortMask;
#endif
#endif
then since the example kept timing out with a watchdog, as many display routines are designed to be both as fast as possible yet slow, I either had to go through the example and add yield() everywhere..
instead mod the
void Adafruit_SSD1306::display(void) {
function in the library .. search for (around line 529)
#ifdef __AVR__
//#ifndef __SAM3X8E__
uint8_t twbrbackup = TWBR;
TWBR = 12; // upgrade to 400KHz!
#endif
//Serial.println(TWBR, DEC);
//Serial.println(TWSR & 0x3, DEC);
that part of the code and add ..
#ifdef ESP8266
yield();
#endif
and this area at the bottom of the function ..(line 550 after above mods)
//#ifndef __SAM3X8E__
#ifdef __AVR__
TWBR = twbrbackup;
#endif
add this afterwards...
#ifdef ESP8266
yield();
#endif
then whenever the display is updated the yield is called at both the start and finish of the display routine.
have no yields at all in the example code any longer and it is running crash free.
Having a lot of trouble reprogramming however, I am not sure if it is the wire call redirecting i2c functions to GPIO 0 and 2 or if its dodgy wiring, added a 2 second boot delay that helps reprogramming at times.. but I still seem to have to power the unit on and off to get it loading.