bernii / embedded-graphics-framebuf

Generic framebuffer implementation in Rust for use with embedded-graphics library
MIT License
26 stars 6 forks source link

Implement FrameBufferBackend for slices #23

Closed jounathaen closed 6 months ago

jounathaen commented 6 months ago

This is useful, e.g., if the framebuffer is declared by another entity and is passed to the application as a pointer and a size.

svenstaro commented 6 months ago

Should we add a note somewhere that this might not work with DMA if the buffer lives in PSRAM connected via SPI (which is then by its nature not DMA)?

jounathaen commented 6 months ago

Hmm, this might be a problem indeed. However, I think this issue persisted before and I don't think this is related to this PR.

I'm not so deep into this code anymore, but isn't what we do, that we basically implement ReadBuffer for all &mut [C;N] in https://github.com/bernii/embedded-graphics-framebuf/blob/4205fb28cf413c04a5d711d345482a409f2c606c/src/backends.rs#L92, but we have a note that the requirements from https://docs.rs/embedded-dma/latest/embedded_dma/trait.ReadBuffer.html still apply. The rules there don't state that it needs to be DMA enabled memory, indeed.

Maybe you have a better idea, but my suggestion would be to add this to embedded_dma.

svenstaro commented 6 months ago

So, I think this PR by itself is totally fine and fulfills my feature request in #22. DMA not being possible with SPRAM via SPI is an orthogonal issue.

jounathaen commented 6 months ago

@bernii With two "approvals", I take the freedom to merge this now :slightly_smiling_face: