almindor / st7789

Rust library for displays using the ST7735 driver
https://docs.rs/st7735-lcd
MIT License
47 stars 24 forks source link

how to share the SPI bus between this crate and another? #20

Open mutantbob opened 2 years ago

mutantbob commented 2 years ago

If I want to transfer data between an OV5642 camera (SPI) and an ST7789 display, how do I share the SPI bus?

The display_interface_spi::SPIInterface takes ownership of the SPI object, preventing me from sharing it with the OV5642, and I can not buffer the entire image (320x240 even converted to 16 bits would exceed the RAM on the Arduino Uno).

almindor commented 2 years ago

This is a problem in the HAL of your PAC. I've tried to solve this for the RISC-V MCUs of E310x family by introducing a shared device concept based on this design with this similar implementation in the HAL

So sadly if you need shared bus, the HAL implementor for your SoC will need to add that.

almindor commented 2 years ago

As for a workaround you can use release() to get the SPI back and sort of just juggle the around. Display interface has a release() as well which will give you the whole thing back. It's a crappy workaround tho.