9names / uc8151-rs

A Rust port of Pimoroni's uc8151 driver, as used on badger2040
8 stars 2 forks source link

Partial Display Refresh Support #1

Closed skmcgrail closed 1 year ago

skmcgrail commented 1 year ago

Adds partial display refresh support based on the Pimoroni C implementation.

9names commented 1 year ago

Hi, thanks for the PR! Have you tested this? It doesn't seem to be working for me, I tried with

let repaint_region = Rectangle::new(Point::new(32, 32), Size::new(32, 32));
let _ = display.partial_update(repaint_region.into());

According to the docs for the micropython driver the only restriction is that the Y values must be a multiple of 8, which the above should be doing fine. Also, we should probably document this requirement, and maybe enforce it.

skmcgrail commented 1 year ago

Updated the pull request to implement the feedback on checking the boundaries on the Y/Height values, and added relevant documentation.

I also uploaded a test driver that you can use test it. This will iterate all 16 channels of the display (128/8) to show off the partial refresh for each vertical segment. You can find that here. I've only tested this with a badger2040 (only device I have with this screen), so if you have another device that has smaller or full-size resolution would be good to verify as well.