Adafruit_GFX_Library missing?

Hi

I’m using the Adafruit_SSD1306 display, and I would like to use a smaller font to view more.

In another project (non Particle) the Adafruit_GFX_Library contains the TomThumb.h file:
#include <Fonts/TomThumb.h>

However, this library seems to be missing from Particle libraries ? Are there plans to port it ?

Alternatively, I think I should just be able to include the .h file, but that does seem possible using the webIDE, but seems like thats possible using the Particle workbench at least.

Thanks

There is an Adafruit_mfGFX library where mf stands for multi-font.

You can. In the top right corner of the editor window you see a (+) icon to add new file tabs where you can copy/paste the sources.
See here
https://docs.particle.io/tutorials/developer-tools/build/xenon/#adding-files-to-your-app

Thanks!

Added mfGFX, and added the .h file, but now get this:
src/TomThumb.h:262:7: error: ‘GFXglyph’ does not name a type
const GFXglyph TomThumbGlyphs[] PROGMEM = {
^
src/TomThumb.h:471:7: error: ‘GFXfont’ does not name a type
const GFXfont TomThumb PROGMEM = {
^

I have a port of the current Adafruit GFX library including the font .h files:

You should just be able to use the library “Adafruit_GFX_RK” in the community libraries instead of “Adafruit_GFX_Library”.

2 Likes

Thanks!
So tried to add the library in the webIDE, but on the name it shows zero (when the regular _GFX library shws 27.3k). Do you need to do something different for custom libraries ?

Don’t worry about that - there is a fault on the use counter. You will find what you want with the _RK version.

1 Like

Ok! However, when trying to add _RK, the “spinner” just spins, and nothing happens ?

I would try logging out and restart the browser then login. You should quickly have seen the confirmation to include in your project.

Adafruit_GFX works, but Adafruit_GFX_RK just spins.
FYI: I’m in Sweden, maybe something rejects country/IP ranges ?

I doubt that’s the cause. Can you include a screenshot for the spinning?

@heikkij, I have had that issue with that library

You may want to use image in Web IDE and try again.

Heh, threatening to take screenshot seems like it was key! (it just worked now).
I have noticed the spinning before though, so its definitely happening from time to time.
I’ll post a screenshot if it does it again. I’m using Safari.
Chrome (with AdBlockPlus) does not work well with webIDE.
I’m using a fast provider (100/100mbps) and I use google 8.8.8.8 DNS.

Anyway, when using both GFX_RK and SSD_1306 I get errors:
#include <Adafruit_GFX_RK.h>
#include <Adafruit_SSD1306.h>

lib/Adafruit_SSD1306/Adafruit_GFX.cpp:420:0: multiple definition of “Adafruit_GFX::drawLine(short, short, short, short, unsigned short)”

I can’t uncomment the SSD1306 since that is the display I want to use:
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

Ideas ?
Thanks!

Also switch to “Adafruit_SSD1306_RK”.

The problem is that the older “Adafruit_SSD1306” library embeds a copy of Adafruit GFX within itself, which causes conflicts if you want to use a separate newer copy of Adafruit_GFX.

Thanks!
Compiles now. But now the display is not showing anything…

I’ll do some snooping tomorrow: but this is exactly what happened when I tried using the same display on a MKR1300 board and the latest github (didn’t work).

With your branch, it appears to be doing the same.
I did notice there seemed to be a fair amount of changes from the github version and the (working) version, but at the time I just thought lets just stick to what works but now I would really want to use TomThumb as well

Remember to call displayobject.display(); to actually show things on the display. Apologies if you are already doing so. Else a code share?

No, thanks for helping.
Just to clarify, before changing to the _RK version this worked:
display.clearDisplay();
display.setCursor(x, 7);
display.print(msgStr); << msgStr is non blank
display.display();

But after the update, nothing is shown.
Like stated I noticed the same behavior on another arduino (using a newer Adafruit_SSD1306) last week but did not look into it more in depth then.

If anyone is using the _RK version, using the SSD1306 device please let me know

Make sure your declaration is correct. It’s different than the Adafruit one:

The parameters should be width, height, and hardware reset pin (usually -1 for not connected):

Adafruit_SSD1306 display(128, 64, -1);

Also make sure you have the correct I2C address in the display.begin() call.

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
1 Like

Thanks!

But now I’m confused, how does the display then know what pins to use ?

And reset is hooked up to. I basically started with one of the maker kit tutorials, #2 the bus arrival:
https://docs.particle.io/tutorials/hardware-projects/maker-kit/

So this is how I currently set up the display:
// use hardware SPI
#define OLED_DC D3
#define OLED_CS D4
#define OLED_RESET D5
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

display.begin(SSD1306_SWITCHCAPVCC);

The library is for an I2C bus based display. You may be able to adapt it to use SPI by replacing the read and write functions and including an spi.begin();

After comparing the .h files, it seems like I need to add the width and height to the instantiation.

//old Adafruit_SSD1306(int8_t DC, int8_t RST, int8_t CS);
//RK Adafruit_SSD1306(size_t width, size_t height, int8_t DC, int8_t RST, int8_t CS);

//old Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
Adafruit_SSD1306 display(128, 64, OLED_DC, OLED_RESET, OLED_CS);

Looking at the code for the new driver it appears to be able to handle SPI as well,
but the display never light up.

The hardware I have is hard to change to I2C, so not going to do that (you need to resolder some resistors,
take a look at the attached pic)

I think for now I’ll just revert to the old code.

Update: When digging in the .h files the I found the display can do HW scrolling. And it does have a couple of different font sizes. This was good find to show what the display can do: https://lastminuteengineers.com/oled-display-arduino-tutorial/
So in short, I don’t think I need to specify my own font after all. Thanks for all the help!