U8GLIB modfied for internal arduino pullups

https://github.com/olikraus/u8glib

Using SSD1306 based 128×64 I2C display + arduino Uno
Worked fine with the Adafruit library and others that use the default Arduino Wire library.

Eventually after pulling my hair out for awhile I figured out it was because the default arduino library turns on the internal pullup resistors in the atmega chip, and my display has no pull-ups on the PCB (I designed it ;)…

Here is the modified file: http://hilo90mhz.com/wp-content/uploads/2015/09/u8g_com_i2c.c
Only changes are right here starting at line 96 – I just added in the code from the default arduino library that turns on the pullups, the inclusion of Arduino.h is necessary for the SCL and SDA defintion :

#include "Arduino.h" // for digitalWrite SCL and SDA definitions


void u8g_i2c_init(uint8_t options)
{
   digitalWrite(SDA, 1); // activate internal pullups for twi.
   digitalWrite(SCL, 1);

Also it would be great to have a way to set the I2C address of the display with the config options 🙂 I figured out how to edit the u8g_com_arduino_ssd_i2c.c file to change that to 0x3d for my display.

Leave a Reply

Your email address will not be published.