Trait Model

Source
pub trait Model {
    type ColorFormat: RgbColor;

    const FRAMEBUFFER_SIZE: (u16, u16);
    const RESET_DURATION: u32 = 10u32;

    // Required method
    fn init<DELAY, DI>(
        &mut self,
        di: &mut DI,
        delay: &mut DELAY,
        options: &ModelOptions,
    ) -> impl Future<Output = Result<SetAddressMode, ModelInitError<DI::Error>>>
       where DELAY: DelayNs,
             DI: Interface;

    // Provided methods
    fn update_address_window<DI>(
        di: &mut DI,
        _rotation: Rotation,
        sx: u16,
        sy: u16,
        ex: u16,
        ey: u16,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
    fn sleep<DI, DELAY>(
        di: &mut DI,
        delay: &mut DELAY,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface,
             DELAY: DelayNs { ... }
    fn wake<DI, DELAY>(
        di: &mut DI,
        delay: &mut DELAY,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface,
             DELAY: DelayNs { ... }
    fn write_memory_start<DI>(
        di: &mut DI,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
    fn software_reset<DI>(
        di: &mut DI,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
    fn update_options<DI>(
        &self,
        di: &mut DI,
        options: &ModelOptions,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
    fn set_tearing_effect<DI>(
        di: &mut DI,
        tearing_effect: TearingEffect,
        _options: &ModelOptions,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
    fn set_vertical_scroll_region<DI>(
        di: &mut DI,
        top_fixed_area: u16,
        bottom_fixed_area: u16,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
    fn set_vertical_scroll_offset<DI>(
        di: &mut DI,
        offset: u16,
    ) -> impl Future<Output = Result<(), DI::Error>>
       where DI: Interface { ... }
}
Expand description

Display model.

Required Associated Constants§

Source

const FRAMEBUFFER_SIZE: (u16, u16)

The framebuffer size in pixels.

Provided Associated Constants§

Source

const RESET_DURATION: u32 = 10u32

Duration of the active low reset pulse in µs.

Required Associated Types§

Source

type ColorFormat: RgbColor

The color format.

Required Methods§

Source

fn init<DELAY, DI>( &mut self, di: &mut DI, delay: &mut DELAY, options: &ModelOptions, ) -> impl Future<Output = Result<SetAddressMode, ModelInitError<DI::Error>>>
where DELAY: DelayNs, DI: Interface,

Initializes the display for this model with MADCTL from crate::Display and returns the value of MADCTL set by init

Provided Methods§

Source

fn update_address_window<DI>( di: &mut DI, _rotation: Rotation, sx: u16, sy: u16, ex: u16, ey: u16, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

Updates the address window of the display.

Source

fn sleep<DI, DELAY>( di: &mut DI, delay: &mut DELAY, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface, DELAY: DelayNs,

Need to call Self::wake before issuing other commands

Source

fn wake<DI, DELAY>( di: &mut DI, delay: &mut DELAY, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface, DELAY: DelayNs,

Wakes the display after it’s been set to sleep via Self::sleep

Source

fn write_memory_start<DI>( di: &mut DI, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

We need WriteMemoryStart befor write pixel

Source

fn software_reset<DI>( di: &mut DI, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

SoftReset

Source

fn update_options<DI>( &self, di: &mut DI, options: &ModelOptions, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

This function will been called if user update options

Source

fn set_tearing_effect<DI>( di: &mut DI, tearing_effect: TearingEffect, _options: &ModelOptions, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

Configures the tearing effect output.

Source

fn set_vertical_scroll_region<DI>( di: &mut DI, top_fixed_area: u16, bottom_fixed_area: u16, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

Sets the vertical scroll region.

The top_fixed_area and bottom_fixed_area arguments can be used to define an area on the top and/or bottom of the display which won’t be affected by scrolling.

Note that this method is not affected by the current display orientation and will always scroll vertically relative to the default display orientation.

The combined height of the fixed area must not larger than the height of the framebuffer height in the default orientation.

After the scrolling region is defined the set_vertical_scroll_offset can be used to scroll the display.

Source

fn set_vertical_scroll_offset<DI>( di: &mut DI, offset: u16, ) -> impl Future<Output = Result<(), DI::Error>>
where DI: Interface,

Sets the vertical scroll offset.

Setting the vertical scroll offset shifts the vertical scroll region upwards by offset pixels.

Use set_vertical_scroll_region to setup the scroll region, before using this method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Model for GC9A01

Source§

impl Model for GC9107

Source§

impl Model for ILI9225Rgb565

Source§

impl Model for ILI9341Rgb565

Source§

impl Model for ILI9341Rgb666

Source§

impl Model for ILI9342CRgb565

Source§

impl Model for ILI9342CRgb666

Source§

impl Model for ILI9486Rgb565

Source§

impl Model for ILI9486Rgb666

Source§

impl Model for ILI9488Rgb565

Source§

impl Model for ILI9488Rgb666

Source§

impl Model for RM67162

Source§

impl Model for ST7735s

Source§

impl Model for ST7789

Source§

impl Model for ST7796