Working library for SSD1306

What are you developing?
dev
Posts: 34
Joined: Sun Feb 19, 2017 8:41 am

Working library for SSD1306

Post by dev » Wed May 17, 2017 5:28 pm

HI,
I searched in the forum and i got many threads on the same topic. which create some confusion in my mind.
Then i took example from STM32 library examples. After compliation i got error. Following are the error.

Code: Select all

In file included from C:\Users\ajink\Documents\Arduino\my\oled\oled\oled.ino:1:0:

C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306/Adafruit_SSD1306_STM32.h:38:26: fatal error: Adafruit_GFX.h: No such file or directory

 #include <Adafruit_GFX.h>

                          ^

compilation terminated.

exit status 1
Error compiling for board Generic STM32F103C series.
how to add these library?
Is it hardaware I2C or bit bang?

zmemw16
Posts: 1157
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: Working library for SSD1306

Post by zmemw16 » Wed May 17, 2017 5:36 pm


stevestrong
Posts: 1157
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Working library for SSD1306

Post by stevestrong » Wed May 17, 2017 5:38 pm

You should download the Adafruit GFX library from here: https://github.com/adafruit/Adafruit-GFX-Library
and extract the zip to the STM32F1/libraries folder.

dev
Posts: 34
Joined: Sun Feb 19, 2017 8:41 am

Re: Working library for SSD1306

Post by dev » Wed May 17, 2017 6:11 pm

Thanks.

@stevestrong, I copied the library to \STM32F1\libraries\Adafruit_SSD1306 path but still getting error.

Code: Select all










C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306\Adafruit_SSD1306_STM32.cpp: In member function 'virtual void Adafruit_SSD1306::drawPixel(int16_t, int16_t, uint16_t)':

C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306\Adafruit_SSD1306_STM32.cpp:115:14: error: 'swap' was not declared in this scope

     swap(x, y);

              ^

C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306\Adafruit_SSD1306_STM32.cpp: In member function 'virtual void Adafruit_SSD1306::drawFastHLine(int16_t, int16_t, int16_t, uint16_t)':

C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306\Adafruit_SSD1306_STM32.cpp:571:16: error: 'swap' was not declared in this scope

       swap(x, y);

                ^

C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306\Adafruit_SSD1306_STM32.cpp: In member function 'virtual void Adafruit_SSD1306::drawFastVLine(int16_t, int16_t, int16_t, uint16_t)':

C:\Users\ajink\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\libraries\Adafruit_SSD1306\Adafruit_SSD1306_STM32.cpp:639:16: error: 'swap' was not declared in this scope

       swap(x, y);

                ^

exit status 1
Error compiling for board Generic STM32F103C series.
I took example from \STM32F1\libraries\Adafruit_SSD1306\examples\ssd1306_128x64_i2c_STM32\ssd1306_128x64_i2c_STM32.ino

Is it correct?

stevestrong
Posts: 1157
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Working library for SSD1306

Post by stevestrong » Wed May 17, 2017 8:12 pm

Search the repo for swap and add the definition to the header file.

dev
Posts: 34
Joined: Sun Feb 19, 2017 8:41 am

Re: Working library for SSD1306

Post by dev » Thu May 18, 2017 6:00 pm

But, Is there working library and example?
Because i was trying to correct the error before posting here.

zmemw16
Posts: 1157
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: Working library for SSD1306

Post by zmemw16 » Thu May 18, 2017 9:13 pm

have you configured the 1306 header file for the display type and size ?
srp

dev
Posts: 34
Joined: Sun Feb 19, 2017 8:41 am

Re: Working library for SSD1306

Post by dev » Fri May 26, 2017 5:38 pm

yes, i have define LCD type and size of lcd as well in Adafruit_SSD1306_STM32.h

found the solution. Defined
#define swap(a, b) { int16_t t = a; a = b; b = t; }


and it compiled. Soon i will checking on hardware.

dev
Posts: 34
Joined: Sun Feb 19, 2017 8:41 am

Re: Working library for SSD1306

Post by dev » Sun May 28, 2017 12:43 pm

I checked on hardware but its not working. I have connected oled to
pb10 scl
pb11 sda

Is it correct?
I am using it as per written in comment in the file header.

dev
Posts: 34
Joined: Sun Feb 19, 2017 8:41 am

Re: Working library for SSD1306

Post by dev » Mon May 29, 2017 6:06 pm

When i flashed the code then processor not at all going in loop function.

No Backlight on oled display.

i thinking getting stuck in setup only.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests