### Get Instruction Code Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.EnterSleepMode.html Returns the instruction code for the EnterSleepMode command. ```rust fn instruction(&self) -> u8 ``` -------------------------------- ### Create SetPageAddress Command Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html Use this constructor to create a new Set Page Address command with specified start and end rows. ```rust pub const fn new(start_row: u16, end_row: u16) -> Self ``` -------------------------------- ### Write Memory Start for ILI9341Rgb666 Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.ILI9341Rgb666.html Prepares the display interface for writing pixel data to the ILI9341Rgb666 display's memory. Requires a mutable reference to the display interface. ```rust fn write_memory_start(di: &mut DI) -> Result<(), DI::Error> where DI: Interface, ``` -------------------------------- ### Create SetPixelFormat Command Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPixelFormat.html Use this associated function to create a new `SetPixelFormat` command with the specified pixel format. No setup or imports are required beyond the `PixelFormat` enum definition. ```rust pub const fn new(pixel_format: PixelFormat) -> Self ``` -------------------------------- ### SetPageAddress::new Constructor Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html Creates a new SetPageAddress command with specified start and end rows. ```APIDOC ## impl SetPageAddress ### pub const fn new(start_row: u16, end_row: u16) -> Self Creates a new Set Page Address command. ``` -------------------------------- ### Implement DcsCommand for SoftResetILI9225 Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.SoftResetILI9225.html Implements the DcsCommand trait for SoftResetILI9225, providing methods to get the instruction code and fill parameters for a software reset command. ```rust impl DcsCommand for SoftResetILI9225 { fn instruction(&self) -> u8 { } fn fill_params_buf(&self, _buffer: &mut [u8]) -> usize { } } ``` -------------------------------- ### Get Raw DCS Interface Source: https://docs.rs/mipidsi/0.10.0/mipidsi/struct.Display.html Provides unsafe access to the DCS (Display Command Set) interface for sending raw commands. Use with caution, ensuring no state conflicts arise. ```rust pub unsafe fn dcs(&mut self) -> &mut DI ``` -------------------------------- ### Get Type ID Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.EnterSleepMode.html Gets the TypeId of the current type. This is part of the Any trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Initialize a display with Builder Source: https://docs.rs/mipidsi/0.10.0/mipidsi/struct.Builder.html Demonstrates the fluent configuration pattern to set up a display instance, including reset pin, color order, and dimensions. ```rust use mipidsi::{Builder, options::ColorOrder, models::ILI9342CRgb565}; let mut display = Builder::new(ILI9342CRgb565, di) .reset_pin(rst) .color_order(ColorOrder::Bgr) .display_size(320, 240) .init(&mut delay).unwrap(); ``` -------------------------------- ### Initialize Display and Draw Test Image Source: https://docs.rs/mipidsi/0.10.0/mipidsi/_troubleshooting/index.html Initializes the display using the Builder and draws a test image to verify color settings. Ensure the reset pin is controlled or held high before initialization. The backlight must be managed manually. ```rust use embedded_graphics::prelude::*; use mipidsi::{Builder, TestImage, models::ILI9486Rgb666}; let mut display = Builder::new(ILI9486Rgb666, di) .reset_pin(rst) .init(&mut delay) .unwrap();; TestImage::new().draw(&mut display)?; ``` -------------------------------- ### Create SpiInterface Instance Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.SpiInterface.html Initializes a new SpiInterface with the provided SPI device, DC pin, and a mutable buffer for data. The buffer should be large enough to hold several pixels. ```rust pub fn new(spi: SPI, dc: DC, buffer: &'a mut [u8]) -> Self> ``` -------------------------------- ### Implement Any for T Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.SoftResetILI9225.html Implements the Any trait for generic types, providing a method to get the TypeId of the instance. ```rust impl Any for T where T: 'static + ?Sized, { fn type_id(&self) -> TypeId { } } ``` -------------------------------- ### Implement Any Trait for WriteMemoryStartILI9225 Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.WriteMemoryStartILI9225.html Implements the Any trait for WriteMemoryStartILI9225, providing a method to get the TypeId of the struct. ```rust impl Any for T where T: 'static + ?Sized, { fn type_id(&self) -> TypeId { } } ``` -------------------------------- ### Builder Initialization and Configuration Source: https://docs.rs/mipidsi/0.10.0/mipidsi/struct.Builder.html This section covers the creation and configuration of the mipidsi Builder, including setting various display options and initializing the display. ```APIDOC ## Builder API ### Struct Builder `pub struct Builder` **Description:** Builder for Display instances. Exposes all possible display options. ### Examples ```rust use mipidsi::{Builder, options::ColorOrder, models::ILI9342CRgb565}; let mut display = Builder::new(ILI9342CRgb565, di) .reset_pin(rst) .color_order(ColorOrder::Bgr) .display_size(320, 240) .init(&mut delay).unwrap(); ``` ### Methods #### `new(model: MODEL, di: DI) -> Self` **Description:** Constructs a new builder for the given Model. **Parameters:** - **model** (MODEL) - The display model to use. - **di** (DI) - The display interface. #### `invert_colors(self, color_inversion: ColorInversion) -> Self` **Description:** Sets the invert color flag. **Parameters:** - **color_inversion** (ColorInversion) - The color inversion setting. #### `color_order(self, color_order: ColorOrder) -> Self` **Description:** Sets the ColorOrder. **Parameters:** - **color_order** (ColorOrder) - The color order setting. #### `orientation(self, orientation: Orientation) -> Self` **Description:** Sets the Orientation. **Parameters:** - **orientation** (Orientation) - The display orientation. #### `refresh_order(self, refresh_order: RefreshOrder) -> Self` **Description:** Sets the refresh order. **Parameters:** - **refresh_order** (RefreshOrder) - The refresh order setting. #### `display_size(self, width: u16, height: u16) -> Self` **Description:** Sets the display size. **Parameters:** - **width** (u16) - The display width. - **height** (u16) - The display height. #### `display_offset(self, x: u16, y: u16) -> Self` **Description:** Sets the display offset. **Parameters:** - **x** (u16) - The x-offset. - **y** (u16) - The y-offset. #### `reset_pin(self, rst: RST2) -> Builder` **Description:** Sets the reset pin. **WARNING:** The reset pin needs to be in _high_ state in order for the display to operate. If it wasn’t provided the user needs to ensure this is the case. **Parameters:** - **rst** (RST2: OutputPin) - The reset pin. #### `init(self, delay_source: &mut impl DelayNs) -> Result, InitError>` **Description:** Consumes the builder to create a new Display with an optional reset OutputPin. Blocks using the provided `DelayNs` `delay_source` to perform the display initialization. The display will be awake ready to use, no need to call `Display::wake` after init. Returns `InitError` if the area defined by the `display_size` and `display_offset` settings is (partially) outside the framebuffer. **Parameters:** - **delay_source** (&mut impl DelayNs) - The delay source for initialization. **Returns:** A `Result` containing the initialized `Display` or an `InitError`. ``` -------------------------------- ### Create and Rotate Orientation Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/struct.Orientation.html Demonstrates creating a new orientation and rotating it by 90 degrees clockwise. Requires importing Orientation and Rotation from mipidsi::options. ```rust use mipidsi::options::{Orientation, Rotation}; // Rotate display content by 90 degree clockwise. let rotated = Orientation::new().rotate(Rotation::Deg90); ``` -------------------------------- ### SpiInterface::new Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.SpiInterface.html Creates a new instance of the SpiInterface. ```APIDOC ## fn new(spi: SPI, dc: DC, buffer: &'a mut [u8]) -> Self ### Description Creates a new interface for SPI communication. ### Parameters - **spi** (SPI) - The SPI device peripheral. - **dc** (DC) - The Data/Command pin. - **buffer** (&'a mut [u8]) - A mutable buffer used for gathering pixel data batches. ``` -------------------------------- ### SetColumnAddress Constructor Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetColumnAddress.html Creates a new instance of the SetColumnAddress command to define the start and end column addresses. ```APIDOC ## SetColumnAddress::new ### Description Creates a new Set Column Address command with the specified start and end column coordinates. ### Parameters #### Request Body - **start_column** (u16) - Required - The starting column address. - **end_column** (u16) - Required - The ending column address. ### Request Example { "start_column": 0, "end_column": 239 } ``` -------------------------------- ### GC9107 Color Format Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.GC9107.html Defines the color format for the GC9107 display as Rgb565. This is a type alias and requires no setup. ```rust type ColorFormat = Rgb565; ``` -------------------------------- ### Create and Flip Horizontal Orientation Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/struct.Orientation.html Demonstrates creating a new orientation and flipping it horizontally. Requires importing Orientation from mipidsi::options. ```rust use mipidsi::options::{Orientation, Rotation}; // Flip display content horizontally. let flipped = Orientation::new().flip_horizontal(); ``` -------------------------------- ### RM67162 Model: write_memory_start Function Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.RM67162.html Prepares the display for writing pixel data by issuing the WriteMemoryStart command. Requires a mutable reference to the DI (Display Interface). ```rust fn write_memory_start(di: &mut DI) -> Result<(), DI::Error> where DI: Interface, ``` -------------------------------- ### Get Rotation in Degrees Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/enum.Rotation.html Returns the rotation value in degrees. This is useful for calculations or comparisons requiring a numerical degree representation. ```rust pub const fn degree(self) -> i32 ``` -------------------------------- ### Display Models Overview Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/index.html List of available display model structs for different hardware drivers and color modes. ```APIDOC ## Display Models ### Description The `models` module provides implementations for various display drivers. Each struct represents a specific hardware controller and its supported color mode. ### Available Structs - **GC9A01**: GC9A01 display in Rgb565 color mode. - **GC9107**: GC9107 display in Rgb565 color mode. - **ILI9225Rgb565**: ILI9225 display in Rgb565 color mode. - **ILI9341Rgb565**: ILI9341 display in Rgb565 color mode. - **ILI9341Rgb666**: ILI9341 display in Rgb666 color mode. - **ILI9342CRgb565**: ILI9342C display in Rgb565 color mode. - **ILI9342CRgb666**: ILI9342C display in Rgb666 color mode. - **ILI9486Rgb565**: ILI9486 display in Rgb565 color mode. - **ILI9486Rgb666**: ILI9486 display in Rgb666 color mode. - **ILI9488Rgb565**: ILI9488 display in Rgb565 color mode. - **ILI9488Rgb666**: ILI9488 display in Rgb666 color mode. - **RM67162**: RM67162 AMOLED display driver implementation. - **ST7789**: ST7789 display in Rgb565 color mode. - **ST7796**: ST7796 display in Rgb565 color mode. - **ST7735s**: ST7735s display in Rgb565 color mode. ``` -------------------------------- ### DcsCommand Implementation for SetPageAddress Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html Provides methods for interacting with the DcsCommand trait, including getting the instruction code and filling parameters. ```APIDOC ### impl DcsCommand for SetPageAddress #### fn instruction(&self) -> u8 Returns the instruction code. #### fn fill_params_buf(&self, buffer: &mut [u8]) -> usize Fills the given buffer with the command parameters. ``` -------------------------------- ### Initialize ILI9486 display via SPI Source: https://docs.rs/mipidsi Configures an ILI9486 display using an SPI interface without manual chip select control. ```rust use mipidsi::interface::SpiInterface; // Provides the builder for DisplayInterface use mipidsi::{Builder, models::ILI9486Rgb666}; // Provides the builder for Display use embedded_graphics::{prelude::*, pixelcolor::Rgb666}; // Provides the required color type /* Define the SPI interface as the variable `spi` */ /* Define the DC digital output pin as the variable `dc` */ /* Define the Reset digital output pin as the variable `rst` */ // Create a buffer let mut buffer = [0_u8; 512]; // Create a DisplayInterface from SPI and DC pin, with no manual CS control let di = SpiInterface::new(spi, dc, &mut buffer); // Create the ILI9486 display driver from the display interface and optional RST pin let mut display = Builder::new(ILI9486Rgb666, di) .reset_pin(rst) .init(&mut delay).unwrap(); // Clear the display to black display.clear(Rgb666::BLACK).unwrap(); ``` -------------------------------- ### Implement DcsCommand for SetPageAddress Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html Implementations for the DcsCommand trait on SetPageAddress, providing methods to get the instruction code and fill parameters into a buffer. ```rust fn instruction(&self) -> u8 ``` ```rust fn fill_params_buf(&self, buffer: &mut [u8]) -> usize ``` -------------------------------- ### Initialize ILI9341 display via Parallel interface Source: https://docs.rs/mipidsi Configures an ILI9341 display using a parallel 8-bit bus with specific color order settings. ```rust // Provides the builder for DisplayInterface use mipidsi::interface::{Generic8BitBus, ParallelInterface}; // Provides the builder for Display use mipidsi::{Builder, models::ILI9341Rgb666}; // Provides the required color type use embedded_graphics::{prelude::*, pixelcolor::Rgb666}; /* Define digital output pins d0 - d7 for the parallel port as `lcd_dX` */ /* Define the D/C digital output pin as `dc` */ /* Define the WR and Reset digital output pins with the initial state set as High as `wr` and `rst` */ // Create the DisplayInterface from a Generic8BitBus, which is made from the parallel pins let bus = Generic8BitBus::new((lcd_d0, lcd_d1, lcd_d2, lcd_d3, lcd_d4, lcd_d5, lcd_d6, lcd_d7)); let di = ParallelInterface::new(bus, dc, wr); // Create the ILI9341 display driver from the display interface with the RGB666 color space let mut display = Builder::new(ILI9341Rgb666, di) .reset_pin(rst) .color_order(mipidsi::options::ColorOrder::Bgr) .init(&mut delay).unwrap(); // Clear the display to black display.clear(Rgb666::RED).unwrap(); ``` -------------------------------- ### ILI9486Rgb565 Methods Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.ILI9486Rgb565.html Core methods for interacting with the ILI9486 display model. ```APIDOC ## ILI9486Rgb565 Methods ### init Initializes the display for this model with MADCTL and returns the value of MADCTL set by init. ### update_address_window Updates the address window of the display. ### sleep Sets the display to sleep mode. Requires calling `wake` before issuing other commands. ### wake Wakes the display after it has been set to sleep. ### write_memory_start Prepares the display for pixel data writing. ### software_reset Performs a software reset on the display. ### set_tearing_effect Configures the tearing effect output. ### set_vertical_scroll_region Sets the top and bottom fixed areas for vertical scrolling. ### set_vertical_scroll_offset Sets the vertical scroll offset. ``` -------------------------------- ### Define GC9107 Struct Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.GC9107.html Defines the GC9107 struct, representing the display in Rgb565 color mode. No specific setup is required beyond this definition. ```rust pub struct GC9107; ``` -------------------------------- ### Implement CloneToUninit for T Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html This nightly-only experimental API allows cloning a value into uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Initialize ILI9486 display with SPI interface Source: https://docs.rs/mipidsi/0.10.0/mipidsi/index.html Use this snippet to initialize an ILI9486 display connected via SPI. Ensure the SPI interface, DC pin, and an optional reset pin are defined. A delay function is required for initialization. ```rust use mipidsi::interface::SpiInterface; use mipidsi::{Builder, models::ILI9486Rgb666}; use embedded_graphics::{prelude::*, pixelcolor::Rgb666}; /* Define the SPI interface as the variable `spi` */ /* Define the DC digital output pin as the variable `dc` */ /* Define the Reset digital output pin as the variable `rst` */ // Create a buffer let mut buffer = [0_u8; 512]; // Create a DisplayInterface from SPI and DC pin, with no manual CS control let di = SpiInterface::new(spi, dc, &mut buffer); // Create the ILI9486 display driver from the display interface and optional RST pin let mut display = Builder::new(ILI9486Rgb666, di) .reset_pin(rst) .init(&mut delay).unwrap(); // Clear the display to black display.clear(Rgb666::BLACK).unwrap(); ``` -------------------------------- ### Update ILI9341Rgb666 Address Window Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.ILI9341Rgb666.html Updates the address window of the display for the ILI9341Rgb666 model. Requires a mutable reference to the display interface and coordinates for the start and end of the window. ```rust fn update_address_window( di: &mut DI, _rotation: Rotation, sx: u16, sy: u16, ex: u16, ey: u16, ) -> Result<(), DI::Error> where DI: Interface, ``` -------------------------------- ### Initialize ILI9341 display with Parallel interface Source: https://docs.rs/mipidsi/0.10.0/mipidsi/index.html This snippet demonstrates initializing an ILI9341 display using an 8080-style parallel interface. It requires defining the parallel data pins (d0-d7), DC pin, WR pin, and an optional reset pin. The color order can be specified, defaulting to RGB888. ```rust use mipidsi::interface::{Generic8BitBus, ParallelInterface}; use mipidsi::{Builder, models::ILI9341Rgb666}; use embedded_graphics::{prelude::*, pixelcolor::Rgb666}; /* Define digital output pins d0 - d7 for the parallel port as `lcd_dX` */ /* Define the D/C digital output pin as `dc` */ /* Define the WR and Reset digital output pins with the initial state set as High as `wr` and `rst` */ // Create the DisplayInterface from a Generic8BitBus, which is made from the parallel pins let bus = Generic8BitBus::new((lcd_d0, lcd_d1, lcd_d2, lcd_d3, lcd_d4, lcd_d5, lcd_d6, lcd_d7)); let di = ParallelInterface::new(bus, dc, wr); // Create the ILI9341 display driver from the display interface with the RGB666 color space let mut display = Builder::new(ILI9341Rgb666, di) .reset_pin(rst) .color_order(mipidsi::options::ColorOrder::Bgr) .init(&mut delay).unwrap(); // Clear the display to black display.clear(Rgb666::RED).unwrap(); ``` -------------------------------- ### From and Into Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/enum.VerticalRefreshOrder.html Provides standard conversions for VerticalRefreshOrder. `From` allows creating a `VerticalRefreshOrder` from another type, while `Into` allows converting a `VerticalRefreshOrder` into another type. ```rust fn from(t: T) -> T ``` ```rust fn into(self) -> U where U: From, ``` -------------------------------- ### SetScrollStart Trait Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetScrollStart.html Overview of the trait implementations for the SetScrollStart struct, including Clone, Debug, PartialEq, Eq, and others. ```APIDOC ## Trait Implementations for SetScrollStart ### `Clone` - `clone(&self) -> SetScrollStart`: Returns a duplicate of the value. - `clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### `Debug` - `fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### `PartialEq` - `eq(&self, other: &SetScrollStart) -> bool`: Tests for `self` and `other` values to be equal. - `ne(&self, other: &Rhs) -> bool`: Tests for `!=`. ### `Eq` (No methods defined for this trait in the provided text) ### `StructuralPartialEq` (No methods defined for this trait in the provided text) ### Auto Trait Implementations - `Freeze` - `RefUnwindSafe` - `Send` - `Sync` - `Unpin` - `UnsafeUnpin` - `UnwindSafe ### Blanket Implementations - `Any` - `Az` - `Borrow` - `BorrowMut` - `CastFrom` - `CheckedAs` - `CheckedCastFrom` - `CloneToUninit` - `From` - `Into` - `OverflowingAs` - `OverflowingCastFrom` - `SaturatingAs` - `SaturatingCastFrom` - `TryFrom` - `TryInto` - `UnwrappedAs` - `UnwrappedCastFrom` - `WrappingAs ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/enum.BitsPerPixel.html Allows fallible conversion to and from BitsPerPixel. Returns a Result to handle potential conversion errors. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Configure Color Order Source: https://docs.rs/mipidsi/0.10.0/mipidsi/_troubleshooting/index.html Sets the color order for the display. Use this if the colors appear incorrect due to subpixel layout differences. ```rust .color_order(mipidsi::options::ColorOrder::Bgr) ``` -------------------------------- ### From and Into Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/enum.BitsPerPixel.html Allows conversion to and from BitsPerPixel using standard Rust `From` and `Into` traits. Facilitates type conversions. ```rust fn from(t: T) -> T ``` ```rust fn into(self) -> U where U: From ``` -------------------------------- ### Write Raw Instruction and Parameters Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.SpiInterface.html Sends a raw command instruction byte along with a slice of parameter bytes to the display interface. ```rust fn write_raw( &mut self, instruction: u8, param_bytes: &[u8], ) -> Result<(), Self::Error>; ``` -------------------------------- ### Configure Color Order and Inversion Source: https://docs.rs/mipidsi/0.10.0/mipidsi/_troubleshooting/index.html Sets both the color order and color inversion for the display. Use this when both subpixel order and color inversion settings need adjustment. ```rust .color_order(mipidsi::options::ColorOrder::Bgr) .invert_colors(mipidsi::options::ColorInversion::Inverted) ``` -------------------------------- ### TryInto Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/struct.InvalidAngleError.html Provides a fallible conversion from a source type to a destination type, returning a Result. ```APIDOC ## fn try_into(self) -> Result>::Error> ### Description Performs a fallible conversion from the source type to a destination type. ### Method `try_into` ### Parameters None ### Request Body None ### Response - **Result** : Ok(U) on success, Err(Error) on failure. ``` -------------------------------- ### Generic16BitBus Methods Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.Generic16BitBus.html Provides methods for creating, managing, and releasing the pins of a Generic16BitBus. ```APIDOC ## impl Generic16BitBus ### Method: new #### Signature `pub fn new(pins: (P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15)) -> Self` #### Description Creates a new bus instance. This operation does not alter the state of the provided pins. The first pin in the tuple corresponds to the least significant bit (LSB). #### Parameters - **pins**: A tuple containing 16 generic types (`P0` to `P15`), each implementing `OutputPin`. ``` ```APIDOC ### Method: release #### Signature `pub fn release(self) -> (P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15)` #### Description Consumes the `Generic16BitBus` instance and returns the underlying tuple of pins. This operation does not change the state of the pins. #### Returns A tuple containing the 16 `OutputPin` instances that were originally used to construct the bus. ``` -------------------------------- ### TestImage::new Source: https://docs.rs/mipidsi/0.10.0/mipidsi/struct.TestImage.html Creates a new instance of the TestImage struct. ```APIDOC ## pub const fn new() ### Description Creates a new test image instance. This image can be used to check if the display is working and to identify the correct orientation and color settings. ### Method Constructor ### Response - **Self** (TestImage) - A new instance of the test image. ``` -------------------------------- ### Combine Orientation Transformations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/struct.Orientation.html Shows how to combine multiple transformations like rotation and vertical flipping to build complex orientations. The order of operations is crucial and affects the final result. ```rust use mipidsi::options::{Orientation, Rotation}; let orientation = Orientation::new().rotate(Rotation::Deg270).flip_vertical(); // Note that the order of operations is important: assert_ne!(orientation, Orientation::new().flip_vertical().rotate(Rotation::Deg270)); assert_eq!(orientation, Orientation::new().flip_vertical().rotate(Rotation::Deg90)); ``` -------------------------------- ### TryFrom Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/struct.InvalidAngleError.html Provides a fallible conversion from a source type to a destination type, returning a Result. ```APIDOC ## fn try_from(value: U) -> Result>::Error> ### Description Performs a fallible conversion from a source type to a destination type. ### Method `try_from` ### Parameters - **value** (U) - Required - The value to convert. ### Request Body None ### Response - **Result** : Ok(T) on success, Err(Error) on failure. ``` -------------------------------- ### ParallelInterface Constructor Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.ParallelInterface.html Creates a new instance of the ParallelInterface. ```APIDOC ## pub fn new(bus: BUS, dc: DC, wr: WR) -> Self ### Description Create a new parallel GPIO interface for communication with a display driver. ### Parameters - **bus** (BUS) - Required - The OutputBus implementation for data. - **dc** (DC) - Required - The OutputPin for data/command selection. - **wr** (WR) - Required - The OutputPin for the write-enable flag. ``` -------------------------------- ### Create a new Generic16BitBus Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.Generic16BitBus.html Constructs a new Generic16BitBus instance from a tuple of 16 OutputPins. The state of the pins is not modified. ```rust pub fn new( pins: (P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15), ) -> Self ``` -------------------------------- ### try_into Method Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.ILI9342CRgb666.html Provides a method to attempt conversion, returning a Result. ```APIDOC ## fn try_into(self: T) -> Result>::Error> ### Description Performs the conversion. Returns a `Result` which is `Ok` on success or `Err` on failure. ### Method `try_into` ### Parameters - `self` (T) - The value to convert. ### Returns - `Result>::Error>` - The result of the conversion. ``` -------------------------------- ### Send Command with Arguments Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.SpiInterface.html Sends a command byte followed by optional parameter bytes over the SPI interface. ```rust fn send_command(&mut self, command: u8, args: &[u8]) -> Result<(), Self::Error>; ``` -------------------------------- ### Interface Structs and Traits Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/index.html Overview of the core communication interfaces and bus implementations available in the mipidsi crate. ```APIDOC ## Structs ### Generic8BitBus A generic implementation of OutputBus using OutputPins for 8-bit parallel communication. ### Generic16BitBus A generic implementation of OutputBus using OutputPins for 16-bit parallel communication. ### ParallelInterface Implementation for parallel communication interfaces. ### SpiInterface Implementation for SPI communication, including a buffer for data transfer. ## Traits ### Interface Defines the command and pixel interface requirements for display communication. ### OutputBus Represents the data pins of a parallel bus. ``` -------------------------------- ### SpiInterface::send_command Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.SpiInterface.html Sends a command with optional parameters to the display interface. ```APIDOC ## fn send_command(&mut self, command: u8, args: &[u8]) -> Result<(), Self::Error> ### Description Sends a command byte followed by optional arguments to the display. ### Parameters - **command** (u8) - The command byte to send. - **args** (&[u8]) - A slice of bytes representing the command arguments. ``` -------------------------------- ### Display Driver Methods Source: https://docs.rs/mipidsi/0.10.0/mipidsi/struct.Display.html Methods for controlling display state, orientation, and pixel drawing. ```APIDOC ## POST /set_orientation ### Description Sets the display orientation with mirror image parameters. ### Method POST ### Parameters #### Request Body - **orientation** (Orientation) - Required - The orientation configuration to apply. ### Response #### Success Response (200) - **Result** (()) - Returns empty result on success. --- ## POST /set_pixel ### Description Sets a pixel color at the given coordinates. ### Method POST ### Parameters #### Request Body - **x** (u16) - Required - x coordinate - **y** (u16) - Required - y coordinate - **color** (M::ColorFormat) - Required - the color value in pixel format of the display Model ### Response #### Success Response (200) - **Result** (()) - Returns empty result on success. --- ## POST /set_vertical_scroll_region ### Description Sets the vertical scroll region, defining fixed areas at the top and bottom that are not affected by scrolling. ### Method POST ### Parameters #### Request Body - **top_fixed_area** (u16) - Required - Height of the top fixed area. - **bottom_fixed_area** (u16) - Required - Height of the bottom fixed area. ### Response #### Success Response (200) - **Result** (()) - Returns empty result on success. --- ## POST /sleep ### Description Puts the display to sleep to reduce power consumption. ### Method POST ### Parameters #### Request Body - **delay** (D: DelayNs) - Required - Delay provider for timing requirements. ### Response #### Success Response (200) - **Result** (()) - Returns empty result on success. ``` -------------------------------- ### WrappingCast Trait Methods Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetScrollArea.html Documentation for the methods available within the WrappingCast trait. ```APIDOC ## fn wrapping_as(self) -> Dst ### Description Casts the value. ### Method Associated function (method) ### Endpoint N/A (Trait method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Dst** (type) - The cast value in the destination type. #### Response Example None ``` ```APIDOC ## fn wrapping_cast_from(src: Src) -> Dst ### Description Casts the value. ### Method Associated function (static method) ### Endpoint N/A (Trait method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Dst** (type) - The cast value in the destination type. #### Response Example None ``` -------------------------------- ### PixelFormat Constructors Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.PixelFormat.html Provides methods to construct new PixelFormat instances. ```APIDOC ## PixelFormat Constructors ### `new(dpi: BitsPerPixel, dbi: BitsPerPixel) -> Self` Construct a new PixelFormat with given BitsPerPixel values for DPI and DBI fields. ### `with_all(bpp: BitsPerPixel) -> Self` Construct a new PixelFormat with the same BitsPerPixel value for both DPI and DBI fields. ``` -------------------------------- ### ModelOptions Struct Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/index.html ModelOptions are used for initializing Model implementations. This struct contains various configuration options for display models. ```APIDOC ## Struct: ModelOptions ### Description ModelOptions are passed to the `init` method of Model implementations. They configure the behavior and properties of a display model. ### Fields - **orientation** (Orientation) - Required - Specifies the display orientation. - **color_inversion** (ColorInversion) - Required - Controls color inversion settings. - **color_order** (ColorOrder) - Required - Defines the subpixel color order. - **refresh_order** (RefreshOrder) - Required - Sets the order for display refresh. - **rotation** (Rotation) - Required - Specifies the display rotation. - **tearing_effect** (TearingEffect) - Required - Configures the tearing effect output. ### Example Usage (Conceptual) ```rust use mipidsi::{ModelOptions, Orientation, ColorInversion, ColorOrder, RefreshOrder, Rotation, TearingEffect}; let options = ModelOptions { orientation: Orientation::Landscape, color_inversion: ColorInversion::Off, color_order: ColorOrder::Rgb, refresh_order: RefreshOrder::TopToBottom, rotation: Rotation::Rotate0, tearing_effect: TearingEffect::Off, }; // model.init(&options); ``` ``` -------------------------------- ### TryFrom and TryInto Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.Generic8BitBus.html Provides fallible conversion methods that return a Result, indicating success or failure. ```APIDOC ## `try_from(value: U)` ### Description Performs a fallible conversion from a source type `U` to the destination type `T`. ### Method `try_from(value: U)` ### Parameters - **value** (U) - The value to convert. ### Request Example ```rust let result: Result = MyType::try_from(input_value); ``` ### Response #### Success Response (200) - **Ok(T)** - The converted value of type `T`. #### Error Response - **Err(Error)** - An error of type `T::Error` if the conversion fails. #### Response Example (Success) ```json { "Ok": 123 } ``` #### Response Example (Error) ```json { "Err": "Conversion failed" } ``` ## `try_into(self)` ### Description Performs a fallible conversion from the current type `T` to a target type `U`. ### Method `try_into(self)` ### Parameters None ### Request Example ```rust let result: Result = my_value.try_into(); ``` ### Response #### Success Response (200) - **Ok(U)** - The converted value of type `U`. #### Error Response - **Err(Error)** - An error of type `>::Error` if the conversion fails. #### Response Example (Success) ```json { "Ok": "converted_string" } ``` #### Response Example (Error) ```json { "Err": "Invalid input" } ``` ``` -------------------------------- ### PartialEq Implementation for SetPageAddress Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html Enables equality comparison between SetPageAddress instances. ```APIDOC ### impl PartialEq for SetPageAddress #### fn eq(&self, other: &SetPageAddress) -> bool Tests for `self` and `other` values to be equal, and is used by `==`. #### fn ne(&self, other: &Rhs) -> bool Tests for `!=`. ``` -------------------------------- ### Release SpiInterface Resources Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.SpiInterface.html Deconstructs the SpiInterface, releasing ownership of the SPI peripheral and DC pin. ```rust pub fn release(self) -> (SPI, DC)> ``` -------------------------------- ### SoftReset Command Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SoftReset.html Details on the SoftReset struct and its implementation of the DcsCommand trait for display control. ```APIDOC ## SoftReset ### Description Represents a software reset command for display devices. It implements the DcsCommand trait to provide the necessary instruction code and parameter buffer handling. ### Methods - **instruction(&self) -> u8**: Returns the instruction code for the software reset. - **fill_params_buf(&self, _buffer: &mut [u8]) -> usize**: Fills the provided buffer with command parameters and returns the number of bytes written. ``` -------------------------------- ### TryFrom and TryInto Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.RM67162.html Implements the `TryFrom` and `TryInto` traits for fallible conversions between types. These conversions return a `Result` to indicate success or failure. ```APIDOC ## TryFrom for T ### Description Provides a fallible conversion from type `U` into type `T`. This is useful when a conversion might fail due to incompatible values or constraints. ### Type Alias - **Error**: `Infallible` - The type returned in the event of a conversion error. Note: `Infallible` indicates that this specific implementation does not produce errors. ### Method - **try_from(value: U)** -> `Result>::Error>` Performs the conversion from `value` of type `U` to type `T`. Returns `Ok(T)` on success or `Err(Error)` on failure. ## TryInto for T ### Description Provides a fallible conversion from type `T` into type `U`. This is the reciprocal trait to `TryFrom`. ### Type Alias - **Error**: `>::Error` - The type returned in the event of a conversion error. ### Method - **try_into(self)** -> `Result>::Error>` Performs the conversion of `self` (type `T`) into type `U`. Returns `Ok(U)` on success or `Err(Error)` on failure. ``` -------------------------------- ### Generic8BitBus Trait Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.Generic8BitBus.html Outlines the trait implementations for Generic8BitBus, focusing on its role as an OutputBus and its conversion capabilities. ```APIDOC ## Trait Implementations ### impl From<(P0, P1, P2, P3, P4, P5, P6, P7)> for Generic8BitBus #### fn from(pins: (P0, P1, P2, P3, P4, P5, P6, P7)) -> Self Converts to this type from the input type. ### impl OutputBus for Generic8BitBus #### const KIND: InterfaceKind = InterfaceKind::Parallel8Bit Interface kind. #### type Word = u8 u8 for 8-bit buses, u16 for 16-bit buses, etc. #### type Error = E Error type #### fn set_value(&mut self, value: Self::Word) -> Result<(), Self::Error> Set the output bus to a specific value ``` -------------------------------- ### Implement PartialEq for SetPixelFormat Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPixelFormat.html Allows comparison of two `SetPixelFormat` instances for equality using the `==` operator. Requires the `Rhs` type to be in scope for the `ne` method. ```rust fn eq(&self, other: &SetPixelFormat) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### StructuralPartialEq Implementation for SetPageAddress Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetPageAddress.html Provides structural equality comparison for SetPageAddress. ```APIDOC ### impl StructuralPartialEq for SetPageAddress ``` -------------------------------- ### Generic8BitBus Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/interface/struct.Generic8BitBus.html Details the methods available for the Generic8BitBus struct, including constructors and pin release functionality. ```APIDOC ## impl Generic8BitBus ### pub fn new(pins: (P0, P1, P2, P3, P4, P5, P6, P7)) -> Self Creates a new bus. This does not change the state of the pins. The first pin in the tuple is the least significant bit. ### pub fn release(self) -> (P0, P1, P2, P3, P4, P5, P6, P7) Consumes the bus and returns the pins. This does not change the state of the pins. ``` -------------------------------- ### DCS Command Interface Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/index.html Overview of the DCS command structures and the InterfaceExt trait used for executing commands. ```APIDOC ## DCS Command Structures ### Description The `dcs` module provides structs representing standard MIPI DCS commands. These commands are used to configure display behavior, including power states, addressing, and pixel formats. ### Key Structs - **EnterSleepMode**: Command to enter sleep mode. - **ExitSleepMode**: Command to exit sleep mode. - **SetDisplayOn**: Command to turn the display on. - **SetDisplayOff**: Command to turn the display off. - **SetPixelFormat**: Configures the pixel format using DPI and DBI settings. - **SetColumnAddress**: Sets the column start and end addresses. - **SetPageAddress**: Sets the page start and end addresses. - **WriteMemoryStart**: Initiates a framebuffer memory write operation. ### Traits - **DcsCommand**: A common trait implemented by all DCS command structs. - **InterfaceExt**: An extension trait for the `Interface` type that provides methods to write DCS commands to the display hardware. ``` -------------------------------- ### ILI9341Rgb666 Model Interface Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.ILI9341Rgb666.html Core methods for interacting with the ILI9341 display model. ```APIDOC ## ILI9341Rgb666 Model Methods ### Description Methods to initialize, control, and configure the ILI9341 display using the Rgb666 color mode. ### Methods - **init**: Initializes the display and returns the MADCTL value. - **update_address_window**: Sets the active pixel area for drawing. - **sleep / wake**: Manages display power states. - **set_tearing_effect**: Configures the tearing effect output. - **set_vertical_scroll_region / set_vertical_scroll_offset**: Manages vertical scrolling parameters. - **software_reset**: Performs a soft reset of the display controller. ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.rs/mipidsi/0.10.0/mipidsi/options/enum.VerticalRefreshOrder.html Enables fallible conversions for VerticalRefreshOrder. `TryFrom` attempts to convert a value of type `U` into `VerticalRefreshOrder`, returning a `Result`. `TryInto` provides the reverse conversion. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> where U: Into, ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> where U: TryFrom, ``` -------------------------------- ### ILI9342CRgb565 Model Interface Source: https://docs.rs/mipidsi/0.10.0/mipidsi/models/struct.ILI9342CRgb565.html Core methods for interacting with the ILI9342C display controller. ```APIDOC ## ILI9342CRgb565 Model Methods ### Description Methods for initializing and controlling the ILI9342C display in Rgb565 mode. ### Methods - **init**: Initializes the display and returns the MADCTL value. - **update_address_window**: Updates the active pixel address window. - **sleep**: Puts the display into sleep mode. - **wake**: Wakes the display from sleep mode. - **write_memory_start**: Prepares the display for pixel data transmission. - **software_reset**: Performs a software reset of the display. - **set_tearing_effect**: Configures the tearing effect output. - **set_vertical_scroll_region**: Sets the vertical scroll area. - **set_vertical_scroll_offset**: Sets the vertical scroll offset. ``` -------------------------------- ### SetAddressMode Constructor Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetAddressMode.html Creates a new instance of the SetAddressMode command with specified display parameters. ```APIDOC ## pub const fn new(color_order: ColorOrder, orientation: Orientation, refresh_order: RefreshOrder) -> Self ### Description Creates a new Set Address Mode command with the provided configuration. ### Parameters - **color_order** (ColorOrder) - Required - The color order configuration. - **orientation** (Orientation) - Required - The display orientation configuration. - **refresh_order** (RefreshOrder) - Required - The refresh order configuration. ### Response - **Self** - A new instance of SetAddressMode. ``` -------------------------------- ### SetDisplayOn Struct Source: https://docs.rs/mipidsi/0.10.0/mipidsi/dcs/struct.SetDisplayOn.html The SetDisplayOn struct represents the command to turn the display on. It implements the DcsCommand trait. ```APIDOC ## SetDisplayOn ### Description Represents the 'Turn Display On' command for the display driver. ### Methods - **instruction() -> u8**: Returns the instruction code for the command. - **fill_params_buf(&self, _buffer: &mut [u8]) -> usize**: Fills the provided buffer with command parameters. ```