SSD1306

Hi,

I am trying to use SSD1306 (Amazon.com) with Hologram Dash. It would not compile. I get the following errors:

C:\Users\fikhas\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp: In member function ‘void Adafruit_SSD1306::begin(uint8_t, uint8_t, bool)’:

C:\Users\fikhas\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:178:17: error: cannot convert ‘volatile uint32_t* {aka volatile long unsigned int*}’ to ‘PortReg* {aka volatile unsigned char*}’ in assignment

 csport      = portOutputRegister(digitalPinToPort(cs));

             ^

C:\Users\fikhas\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:180:17: error: cannot convert ‘volatile uint32_t* {aka volatile long unsigned int*}’ to ‘PortReg* {aka volatile unsigned char*}’ in assignment

 dcport      = portOutputRegister(digitalPinToPort(dc));

             ^

C:\Users\fikhas\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:188:19: error: cannot convert ‘volatile uint32_t* {aka volatile long unsigned int*}’ to ‘PortReg* {aka volatile unsigned char*}’ in assignment

   clkport     = portOutputRegister(digitalPinToPort(sclk));

               ^

C:\Users\fikhas\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:190:19: error: cannot convert ‘volatile uint32_t* {aka volatile long unsigned int*}’ to ‘PortReg* {aka volatile unsigned char*}’ in assignment

   mosiport    = portOutputRegister(digitalPinToPort(sid));

I found this entry about SSD1306 (Using with Arduino compatble devices (I2C, etc.)) but I am not sure if this solves my problem and if so, how to add a processor definition.

Any help is greatly appreciated.

Thanks & regards,
Firas Khasawneh

I don’t have that specific hardware to test with unfortunately. Version 1.0 of the Adafruit SSD1306 library did not compile with the Dash due to the way board defines were handled. I made a forked version of the library that compiled with the Dash (GitHub - LightProjection/Adafruit_SSD1306: SSD1306 oled driver library for 'monochrome' 128x64 and 128x32 OLEDs!). Shortly after that, version 1.1 and 1.2 of the Adafruit library was released which looks like it has fixed the board defines.

I was able to build both the I2C and SPI versions of the version 1.2 library examples for 128x64 device. I would start with the version 1.2 library and see if that works for you. You’ll need to set the SPI or IC2 pins to the corresponding Dash pins in the sketch.

I ordered that display to check it out. The documentation for that display says to use their own library, and NOT to use the Adafruit library. Unfortunately, the custom library is a maze of low-level AVR calls, so it’s not going to work with the Dash without major modifications. You may be able to hack in some code that uses the Arduino standard Wire library that the Dash does support for I2C devices.

I have a write-up on using the Adafruit SSD1306 with the Dash over SPI:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.