This is a fork from wjklimek1's repo, for more details check out his repo. This fork focuses on the compatibility with the Arduino framework (especially working with the ESP32 mcu).
- Implemented Arduino compatibility
- Translated files to cpp
- Added wrapper class 'SSD1322.h' which holds and instances the 'sub-modules' correctly
- Added an ESP32 example (PlatformIO project)
- Deleted the STM32F4 Example
Portable library for 256x64 OLED display with SSD1322 controller
Library is divided into three layers:
- Hardware driver - contains all hardware dependent functions wrappers.
- API - commands, initialization seqence, functions to change screen grayscale levels, color inversion, contrasct, etc. Uses only functions from hardware driver to send data to OLED.
- GFX - functions to draw on frame buffer. Drawing single pixels, graphic primitives, lines, bitmaps and fonts. Operates only on frame buffer. Only function that sends buffer to OLED calls API funtions.
GFX library can draw text with fonts provided by AdafruitGFX library. To write text with Adafruit font include font file and select font with function:
void select_font(const GFXfont *new_gfx_font)
for example:
select_font(&FreeMono12pt7b);
When font is already selected you can use it to write text on screen. It works only for null terminated strings!
Two bitmap formats are supported:
void draw_bitmap_8bpp(uint8_t *frame_buffer, const uint8_t *bitmap, uint16_t x0, uint16_t y0, uint16_t x_size, uint16_t y_size);
It draws bitmap where one pixel corresponds to one byte - just an 8bit grayscale bitmaps.
void draw_bitmap_4bpp(uint8_t *frame_buffer, const uint8_t *bitmap, uint16_t x0, uint16_t y0, uint16_t x_size, uint16_t y_size);
Here one byte in bitmap stores brightness value for two pixels - just like in the actual framebuffer.
To convert bitmaps to 8 or 4 bits per pixel grayscale depth you can use converter from this link, downloading software "Converting bitmap to Hex". It's a bit buggy but worked for most bitmaps I tried to convert.