pub trait DisplayDriver:
AsRef<Self::Display>
+ AsMut<Self::Display>
+ 'static {
type Display: DrawTarget<Color = BinaryColor>;
// Provided methods
async fn init(&mut self) -> Result<(), DisplayError> { ... }
async fn flush(&mut self) -> Result<(), DisplayError> { ... }
async fn set_brightness(
&mut self,
_brightness: u8,
) -> Result<(), DisplayError> { ... }
async fn set_display_on(&mut self, on: bool) -> Result<(), DisplayError> { ... }
}
Expand description
Interface for display drivers.
TODO: Allow sync-only drivers?
Required Associated Types§
type Display: DrawTarget<Color = BinaryColor>
Provided Methods§
Sourceasync fn init(&mut self) -> Result<(), DisplayError>
async fn init(&mut self) -> Result<(), DisplayError>
Called when the display is initialized.
It is guaranteed that:
- No other function is called before this function.
- If this function returns an error, other functions will not be called.
Default implementation returns Ok(())
.
async fn flush(&mut self) -> Result<(), DisplayError>
Sourceasync fn set_brightness(&mut self, _brightness: u8) -> Result<(), DisplayError>
async fn set_brightness(&mut self, _brightness: u8) -> Result<(), DisplayError>
Sets brightness of the display.
0 is off, 255 is full brightness.
async fn set_display_on(&mut self, on: bool) -> Result<(), DisplayError>
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.