nrf-rs / microbit

A Rust crate for BBC micro:bit development
BSD Zero Clause License
276 stars 61 forks source link

LED display, demo blocking scan line implementation #4

Closed droogmic closed 6 years ago

droogmic commented 6 years ago

Simple driver implementation for LED display.

The implementation scans through the 3 matrix rows fast enough to display the image without flickering.

@therealprof this follows on from our discussion earlier. It appears to work pretty well.

therealprof commented 6 years ago

Very nice. We should probably pull this out into a generic driver and support timers but for now this is a good demonstration how to drive the matrix. Thanks a lot.

therealprof commented 6 years ago

NB: The example didn't compile and Cargo.toml was missing the used semihosting crate. Also the code was not Rust formatted. I fixed that up and upped the version of the crate.

droogmic commented 6 years ago

I am glad you approve, your comments earlier had me thinking it would be much more difficult.

Thanks for cleaning up the example, I had copied it over from my book crate without really testing it, my apologies... It also seems I need configure my IDE to warn me of those formatting issues.

Besides the TODOs, I think I may need to fix 2 more things. To find issues at compile time, the Display::new() should probably take the undowngraded pin types. I also need to remove the hardcoded 3 in set_refresh_rate

therealprof commented 6 years ago

@droogmic

I am glad you approve, your comments earlier had me thinking it would be much more difficult.

Ideally the display would work independently of other code running (i.e. non-blocking) which is going to be a lot more difficult. ;)