From 0a5ed28784fd14f234ea2434c51abb1c8ec5923d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Katona?= Date: Thu, 24 Oct 2024 09:57:35 -0700 Subject: [PATCH] add doc warnings --- mipidsi/src/lib.rs | 18 +++++++++++++++++- mipidsi/src/models.rs | 10 +++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mipidsi/src/lib.rs b/mipidsi/src/lib.rs index 0acfebe..77789f3 100644 --- a/mipidsi/src/lib.rs +++ b/mipidsi/src/lib.rs @@ -222,6 +222,10 @@ where /// * `ex` - x coordinate end /// * `ey` - y coordinate end /// * `colors` - anything that can provide `IntoIterator` to iterate over pixel data + ///
+ /// The `ex`and `ey` coordinates are inclusive. For example when using a rectangle + /// of size `320x240`, one would use `319` an `239` as `ex` and `ey` values. + ///
pub fn set_pixels( &mut self, sx: u16, @@ -255,7 +259,19 @@ where /// * `sy` - y coordinate start /// * `ex` - x coordinate end /// * `ey` - y coordinate end - /// * `raw_buf` - &[u8] buffer of raw pixel data in the format expected by the display. + /// * `raw_buf` - `&[u8]` buffer of raw pixel data in the format expected by the display. + ///
+ /// This method requires the raw_buf data to be in the correct endianness + /// and format expected by the display. + /// + /// The method won't work with a 16bit display-interface-gpio, because it + /// pads the each byte to a u16 instead of converting each two byte chunk + /// into a u16. [See here for more info](https://github.com/therealprof/display-interface/blob/8fca041b0288740678f16c1d05cce21bd3867ee5/parallel-gpio/src/lib.rs#L267) + ///
+ ///
+ /// The ex and ey coordinates are inclusive. For example when using a rectangle + /// of size 320x240, one would use 319 an 239 as ex and ey values. + ///
pub fn set_pixels_raw_u8( &mut self, sx: u16, diff --git a/mipidsi/src/models.rs b/mipidsi/src/models.rs index 1db6291..6681e89 100644 --- a/mipidsi/src/models.rs +++ b/mipidsi/src/models.rs @@ -74,9 +74,17 @@ pub trait Model { DI: WriteOnlyDataCommand, I: IntoIterator; - /// Writes raw &[u8] buffer to the display IC via the given display interface. + /// Writes raw `&[u8]` buffer to the display IC via the given display interface. /// /// No pixel color format conversion, raw data is passed on directly. + ///
+ /// This method requires the `raw_buf` data to be in the correct endianness + /// and format expected by the display. + /// + /// The method won't work with a 16bit display-interface-gpio, because it + /// pads the each byte to a u16 instead of converting each two byte chunk + /// into a u16. [See here for more info](https://github.com/therealprof/display-interface/blob/8fca041b0288740678f16c1d05cce21bd3867ee5/parallel-gpio/src/lib.rs#L267) + ///
fn write_pixels_raw_u8(&mut self, dcs: &mut Dcs, raw_buf: &[u8]) -> Result<(), Error> where DI: WriteOnlyDataCommand,