I bought some of these displays. I use the U8x8lib.h library for them. It works fine in text mode , but the library is missing a function to display bitmaps (generally drawBitmap or drawXBMP). The function exist for a dozen of drivers, but not for HC1105, is there anybody aware of a workaround?
I don’t know this library. As said, U8x8lib supports U8x8lib, but not all methods, for instance drawBitmap and drawXBMP are not implemented for SH1106.
I’m going to have a look to Adafruit_GFX, thanks for that.
Just tried to use U8g2lib. Here is the of compilation report. Last line is explicit.
/home/pfeuh/Documents/sources/C_language/arduino/_project/LFOx4int/LFOx4int.ino: In function ‘void printShape()’: LFOx4int:157:13: error: ‘class U8X8_SH1106_128X64_NONAME_HW_I2C’ has no member named ‘drawBitmap’; did you mean ‘drawTile’?
*Utilisation de la bibliothèque U8g2 version 2.28.10 dans le dossier: /home/pfeuh/snap/arduino/50/Arduino/libraries/U8g2 *
*Utilisation de la bibliothèque SPI version 1.0 dans le dossier: /snap/arduino/50/hardware/arduino/avr/libraries/SPI *
*Utilisation de la bibliothèque Wire version 1.0 dans le dossier: /snap/arduino/50/hardware/arduino/avr/libraries/Wire * exit status 1 ‘class U8X8_SH1106_128X64_NONAME_HW_I2C’ has no member named ‘drawBitmap’; did you mean ‘drawTile’?
He prefers drawXBM() which has methods for Flash and SRAM.
Current Adafruit_GFX style libraries have several drawBitmap() methods.
A hardware library that inherits from Adafruit_GFX gets all the current features.
Some hardware libraries implement native “compatible” GFX functions instead of inheritance. This often means that they miss some newer GFX features.
Thanks for all, David, but I give up. I’ve tried the example given by Oliver, but always the same result, no member named drawBitmap, drawXBM nor drawXBMP.
Having a look at source code, there is really a lot of precompiler directives, almost one #ifdef per driver, so I’ve spent enough time, I’m going to find another solution.
That’s exactly what I wrote. But I don’t know how to say more clearly that this function doesn’t exist for the SH1106 driver, nor in U8g2lib, nor in U8x8. FOr the rest, you’re totally right, 64x64 pixels, monochrome and stored in sram. Here is the code.testOldGraphix2.ino (4.0 KB)
You make my day, I’ve copy-paste your first version, it works on my system. But for your second version, which is the one I would like to use because my bitmaps are in program memory, I don’t find the Adafruit_SH1106_kbv library, the Arduino IDE library manager doesn’t show it.
I just got it on Github, and it works as I expect, a big thumb up for you! Cherry on the pie, this driver doesn’t seem to have the 1kbyte of buffer in sram.
Yes, it will still allocate 1024 bytes of SRAM for the 128x64 buffer. Just make sure that 1024 is available at build time e.g. for SRAM image
Sketch uses 13774 bytes (42%) of program storage space. Maximum is 32256 bytes.
Global variables use 860 bytes (41%) of dynamic memory, leaving 1188 bytes for local variables. Maximum is 2048 bytes.
Sketch uses 13774 bytes (42%) of program storage space. Maximum is 32256 bytes.
Global variables use 348 bytes (16%) of dynamic memory, leaving 1700 bytes for local variables. Maximum is 2048 bytes.
Ouch. This Forum software is a nightmare.
However the SRAM version says 1188 bytes of SRAM. i.e. 1188 - 1024 = 164. Which is very risky.
The PROGMEM version is 1700 - 1024 = 674. Which is much safer.
David, despite the name of the lib (U8x8), I haven’t found any font in 8x8 pixels, like these for vintage computers… Am I wrong?
Using the lib’s font closer to 16x16 used in examples, it seems that it’s a little bit too big in width, lines 2 and 3 have some pixels (only last pixel column, I suppose) at the start of the following line.
I’ve got many problems attempting to mix bitmaps and text. I also gave a lot of time trying to understand the adafruit GFX library. I came to the conclusion that I probably have to write my own minimalist driver.
I have understood (I hope I’m not wrong) that most of methods works with the 1k ram buffer and the method .display() copies the ram to the display().
I haven’t found the code of this command .display(), do you know something about it? Ideally, I miss 2 methods: Display initialization and sending of one byte to the display.
I professionally wrote some code (drivers and applications) before my retirement, including this one.