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§
Sourceconst FRAMEBUFFER_SIZE: (u16, u16)
const FRAMEBUFFER_SIZE: (u16, u16)
The framebuffer size in pixels.
Provided Associated Constants§
Sourceconst RESET_DURATION: u32 = 10u32
const RESET_DURATION: u32 = 10u32
Duration of the active low reset pulse in µs.
Required Associated Types§
Sourcetype ColorFormat: RgbColor
type ColorFormat: RgbColor
The color format.
Required Methods§
Sourcefn init<DELAY, DI>(
&mut self,
di: &mut DI,
delay: &mut DELAY,
options: &ModelOptions,
) -> impl Future<Output = Result<SetAddressMode, ModelInitError<DI::Error>>>
fn init<DELAY, DI>( &mut self, di: &mut DI, delay: &mut DELAY, options: &ModelOptions, ) -> impl Future<Output = Result<SetAddressMode, ModelInitError<DI::Error>>>
Initializes the display for this model with MADCTL from crate::Display and returns the value of MADCTL set by init
Provided Methods§
Sourcefn 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 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.
Sourcefn sleep<DI, DELAY>(
di: &mut DI,
delay: &mut DELAY,
) -> impl Future<Output = Result<(), DI::Error>>
fn sleep<DI, DELAY>( di: &mut DI, delay: &mut DELAY, ) -> impl Future<Output = Result<(), DI::Error>>
Need to call Self::wake before issuing other commands
Sourcefn wake<DI, DELAY>(
di: &mut DI,
delay: &mut DELAY,
) -> impl Future<Output = Result<(), DI::Error>>
fn wake<DI, DELAY>( di: &mut DI, delay: &mut DELAY, ) -> impl Future<Output = Result<(), DI::Error>>
Wakes the display after it’s been set to sleep via Self::sleep
Sourcefn write_memory_start<DI>(
di: &mut DI,
) -> impl Future<Output = Result<(), DI::Error>>where
DI: Interface,
fn write_memory_start<DI>(
di: &mut DI,
) -> impl Future<Output = Result<(), DI::Error>>where
DI: Interface,
We need WriteMemoryStart befor write pixel
Sourcefn software_reset<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,
SoftReset
Sourcefn update_options<DI>(
&self,
di: &mut DI,
options: &ModelOptions,
) -> 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,
This function will been called if user update options
Sourcefn set_tearing_effect<DI>(
di: &mut DI,
tearing_effect: TearingEffect,
_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,
Configures the tearing effect output.
Sourcefn 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_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.
Sourcefn set_vertical_scroll_offset<DI>(
di: &mut DI,
offset: 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,
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.