Skip to content

Commit

Permalink
add doc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
almindor committed Oct 24, 2024
1 parent e663338 commit 0a5ed28
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
18 changes: 17 additions & 1 deletion mipidsi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ where
/// * `ex` - x coordinate end
/// * `ey` - y coordinate end
/// * `colors` - anything that can provide `IntoIterator<Item = u16>` to iterate over pixel data
/// <div class="warning">
/// 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.
/// </div>
pub fn set_pixels<T>(
&mut self,
sx: u16,
Expand Down Expand Up @@ -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.
/// <div class="warning">
/// This method requires the <b>raw_buf</b> data to be in the correct endianness
/// and format expected by the display.
///
/// The method won't <b>work with a 16bit display-interface-gpio</b>, 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)
/// </div>
/// <div class="warning">
/// The <b>ex</b> and <b>ey</b> coordinates are inclusive. For example when using a rectangle
/// of size <b>320x240</b>, one would use <b>319</b> an <b>239</b> as <b>ex</b> and <b>ey</b> values.
/// </div>
pub fn set_pixels_raw_u8(
&mut self,
sx: u16,
Expand Down
10 changes: 9 additions & 1 deletion mipidsi/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ pub trait Model {
DI: WriteOnlyDataCommand,
I: IntoIterator<Item = Self::ColorFormat>;

/// 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.
/// <div class="warning">
/// This method requires the `raw_buf` data to be in the correct endianness
/// and format expected by the display.
///
/// The method <b>won't work with a 16bit display-interface-gpio</b>, 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)
/// </div>
fn write_pixels_raw_u8<DI>(&mut self, dcs: &mut Dcs<DI>, raw_buf: &[u8]) -> Result<(), Error>
where
DI: WriteOnlyDataCommand,
Expand Down

0 comments on commit 0a5ed28

Please sign in to comment.