pub struct Display<DI> { /* private fields */ }
Expand description
Display properties struct
Implementations§
source§impl<DI> Display<DI>where
DI: WriteOnlyDataCommand,
impl<DI> Display<DI>where
DI: WriteOnlyDataCommand,
sourcepub fn new(
iface: DI,
display_size: DisplaySize,
display_rotation: DisplayRotation
) -> Display<DI>
pub fn new( iface: DI, display_size: DisplaySize, display_rotation: DisplayRotation ) -> Display<DI>
Create new Display instance
sourcepub fn init(&mut self) -> Result<(), DisplayError>
pub fn init(&mut self) -> Result<(), DisplayError>
Initialise the display in column mode (i.e. a byte walks down a column of 8 pixels) with column 0 on the left and column (display_width - 1) on the right.
sourcepub fn clear(&mut self) -> Result<(), DisplayError>
pub fn clear(&mut self) -> Result<(), DisplayError>
Clear the display by setting all pixels to black
sourcepub fn set_draw_area(
&mut self,
start: (u8, u8),
end: (u8, u8)
) -> Result<(), DisplayError>
pub fn set_draw_area( &mut self, start: (u8, u8), end: (u8, u8) ) -> Result<(), DisplayError>
Set the position in the framebuffer of the display where any sent data should be
drawn. This method can be used for changing the affected area on the screen as well
as (re-)setting the start point of the next draw
call.
sourcepub fn draw(&mut self, buffer: &[u8]) -> Result<(), DisplayError>
pub fn draw(&mut self, buffer: &[u8]) -> Result<(), DisplayError>
Send the data to the display for drawing at the current position in the framebuffer
and advance the position accordingly. Cf. set_draw_area
to modify the affected area by
this method.
sourcepub fn get_size(&self) -> DisplaySize
pub fn get_size(&self) -> DisplaySize
Get the configured display size
sourcepub fn get_dimensions(&self) -> (u8, u8)
pub fn get_dimensions(&self) -> (u8, u8)
Get display dimensions, taking into account the current rotation of the display
let disp = Display::new(
interface,
DisplaySize::Display128x128,
DisplayRotation::Rotate0
);
assert_eq!(disp.get_dimensions(), (128, 128));
let rotated_disp = Display::new(
interface,
DisplaySize::Display128x128,
DisplayRotation::Rotate90
);
assert_eq!(rotated_disp.get_dimensions(), (128, 128));
sourcepub fn get_rotation(&self) -> DisplayRotation
pub fn get_rotation(&self) -> DisplayRotation
Get the display rotation
sourcepub fn set_rotation(
&mut self,
display_rotation: DisplayRotation
) -> Result<(), DisplayError>
pub fn set_rotation( &mut self, display_rotation: DisplayRotation ) -> Result<(), DisplayError>
Set the display rotation