Adafruit_SSD1306
Adafruit_SSD1306 copied to clipboard
OLED looks corrupted on STM32 when using bitmap or text functions (Previously: Single library uses up almost all my code space)
Hi. I'm using a STM32G0 chip with a custom board, and using the STM32 Arduino core here.
My problem is that for some reason this library takes up an absurd amount of space and 98% of my chip's memory is taken just by including the header. You'd think that the Adafruit graphics library would take up the bulk of the space but it only seems to use ~4K of space tops. Meanwhile this one uses up ~12K!! I understand why it would take up some SRAM but why does it take up so much FLASH program space? Isn't it just a simple library for driving the LCD over I2C? Is there anything I can disable inside the library to reduce the size usage?
UPDATE: I managed to get it to fit by changing the compiler optimization flags. For some reason "smallest" isn't actually the smallest. Go figure. Now I have a new problem though. While the library works when using basic functions like drawRect
, both the drawBitmap
and print
functions do this:
Update 2: In the case of the print function, it only goes garbled if I use setFont to set a custom font. But the weird part is that it's still garbled if I set a font and then clear the screen and go back to default font and try to draw. Also this is only happening on my STM32 board, not on an Uno. Also happens if I call getTextBounds. Also, I've determined that drawBitmap is innocent of the situation, so it's just these text functions that are getting weird.