From 6e96359b44ac95ee88e92bb75b1bfa9f1f13b492 Mon Sep 17 00:00:00 2001 From: Zac Wilson Date: Thu, 18 Dec 2025 11:50:41 +0000 Subject: [PATCH] Wrote more doc comments --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 075abaa..45bacf9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,12 +64,20 @@ pub struct DoubleFrame { partial_window: PartialWindow, } +/// The colour of a given pixel. +/// +/// Since the GDEQ031T10 is pure black-and-white (no greyscale), this is just a two-state enum.S pub enum PixelColour { Black = 0, White = 1, } +/// A trait for partial window strategies for use with [DoubleFrame]. +/// +/// This trait is sealed, so the only strategies available are [NoPartialWindow] +/// and [AutomaticPartialWindow]. pub trait ApplyPartialWindow: private::Sealed { + /// Applies the given window to the display so that its next update will only refresh part of the display. fn apply< BusyPin: InputPin, ResetPin: OutputPin, @@ -81,8 +89,13 @@ pub trait ApplyPartialWindow: private::Sealed { display: &mut EPaperDisplay, ); + /// Add a new bounding box which must be covered by the partial window. + /// + /// Calls to this method accumulate, meaning all bounding boxes will be covered by the + /// partial window until [ApplyPartialWindow::reset_partial_window] is called. fn update_partial_window(&mut self, min_x: u16, max_x: u16, min_y: u16, max_y: u16); + /// Resets the partial window to be empty. fn reset_partial_window(&mut self); } @@ -94,6 +107,8 @@ mod private { impl Sealed for super::AutomaticPartialWindow {} } +/// A partial window strategy which doesn't do any window tracking and simply updates +/// the entire display. pub struct NoPartialWindow; impl ApplyPartialWindow for NoPartialWindow { @@ -114,6 +129,8 @@ impl ApplyPartialWindow for NoPartialWindow { fn reset_partial_window(&mut self) {} } +/// A partial window strategy which tracks the bounding box of all changes made to the display +/// since the last display update and only updates that region. pub struct AutomaticPartialWindow { min_x: u16, max_x: u16, @@ -301,10 +318,12 @@ impl