dazgupta.com > posts.xml 2> journal.xml

RP2040 and running a display

I have been meaning to play around with a bunch of Raspi Picos that I had lying around. But I wanted to try to use it with Rust. Even though the library rp-hal is excellent, it took me some time to understand some of the quirks of the library and how to use it with other embedded and cortex crates. I wanted to run a display from a framebuffer, and eventually move to Rust Embedded Graphics. However, I couldn't make the standard driver for a ST7789 display work with rp-hal and other crates.

That was when I decided to write my own driver, but while trying to do that, I discovered RP2040 ST7789. This was a godsend bit of code that I eventually managed to run and draw something on the screen.

RP2040 + ST7789

Then after a day of mucking around with SPI + DMA, I managed to directly draw from memory, which was faster and without the CPU cycles. Granted, I need to maintain the entire display buffer in memory, which in my case is around 120kB or something, but it made painting directly on the memory much easier and fun without the slow SPI painting.

All in all, some progress in my fantasy game console, and a tonne of fun writing somewhat lower level code years after university.

18-08-2024