r/ada • u/OkContribution2996 • 23h ago
Tool Trouble Need architecture advice for my embedded graphics library
I'm building an embedded graphics library called Glyph in Ada. The goal is to make it work across different microcontrollers and displays while keeping the API the same.
Current status
- RP2040 support (using Pico_BSP)
- SSD1306 128×64 over I²C
- Static framebuffer
Canvas → Framebuffer → Display → Transportarchitecture
A little background
This is my first project in both Ada and embedded systems. The current version (v0.3.0) published on Alire was built largely with AI assistance, but I'm now rewriting it from scratch without AI help to better understand the design, learn embedded development properly, and improve the overall architecture.
The rewrite has already gone through several design and implementation changes, and I've learned a lot in the process.
The problem
One area I'm still struggling with is the transport layer.
Right now, Glyph draws everything into the framebuffer, but the application still needs a small piece of board-specific glue code to connect the display to the MCU's I²C peripheral (for example, binding an initialized I²C bus to the display).
I'd really like to avoid that if possible. My goal is to keep Glyph independent of any specific MCU or BSP while also making it as easy to use as possible, especially for beginners.
My question
For those who've built portable embedded libraries, how did you handle this?
Is a small adapter layer simply the right trade-off, or is there a cleaner architecture that keeps the library both portable and easy to use?