-
Notifications
You must be signed in to change notification settings - Fork 178
Description
Hi there.
I started using a 7.5" V2 display for a project and have started working on integrating this crate into my project.
I experienced quite a bit of flickering when doing full-frame updates so I looked into the Waveshare Arduino examples and saw that they have two different initialization routines for the display: One "normal init", that seems to perform the same configuration as this library does, and one "fast init" that minimizes flickering.
There is also a "partial init" that sets up registers to appropriate values for partial updates, but I haven't gotten to that yet.
So this leads me to the question in the title of this post: The way the display is initializes should not be a "one size fits all" solution and consumers might have different needs. So how should this be exposed?
Just throwing some possible solutions out there:
- Make
fn command(...)/fn cmd_with_data(...)/fn send_data(...)public- Simple solution for maintainers of the crate, more tedious for consumers who will need to learn the datasheet to do anything useful.
- Abstract away registers into one or several configuration structs and implement something like
set_configuration.- Provides the same level of flexibility as the point above, but it costs more. Perhaps not worth it?
- Make use of Rusts type system and encode the different "modes" as typestates:
- Better consumer ergonomics, but might not fit into the low level style of the driver right now.
let device =
Epd7in5::new(&mut spi, busy, dc, rst, &mut delay, None).expect("eink initalize error");
let fast_device = device.into_fast_mode() // Consumes 'self' and returns a device with the appropriate configuration.
// Perform "fast" updates on the display
let partial_device = device.into_partial_mode() // Consumes 'self' and returns a device configured for partial updatesOr is there already a design in place that I have missed? Perhaps there is something totally obvious that I have missed. Let me know your thoughts.