pub trait SimpleDisplayBus: ErrorType {
// Required methods
async fn write_cmds(&mut self, cmd: &[u8]) -> Result<(), Self::Error>;
async fn write_data(&mut self, data: &[u8]) -> Result<(), Self::Error>;
// Provided methods
async fn write_cmd_with_params(
&mut self,
cmd: &[u8],
params: &[u8],
) -> Result<(), Self::Error> { ... }
fn set_reset(
&mut self,
reset: bool,
) -> Result<(), DisplayError<Self::Error>> { ... }
}Expand description
A simplified interface for display buses that don’t need atomic command with params, complex frame control, ROI information, etc. (e.g., standard SPI, I2C).
This trait abstracts over simple serial interfaces where commands and data are just streams of
bytes. It provides a convenient way to implement the full DisplayBus trait without worrying
about frame metadata or pixel-specific handling, as those are handled by the blanket
implementation.
Implementors only need to define how to send raw command bytes and raw data bytes.
Required Methods§
Provided Methods§
Sourceasync fn write_cmd_with_params(
&mut self,
cmd: &[u8],
params: &[u8],
) -> Result<(), Self::Error>
async fn write_cmd_with_params( &mut self, cmd: &[u8], params: &[u8], ) -> Result<(), Self::Error>
Writes a command followed immediately by its parameters.
Sourcefn set_reset(&mut self, reset: bool) -> Result<(), DisplayError<Self::Error>>
fn set_reset(&mut self, reset: bool) -> Result<(), DisplayError<Self::Error>>
Reset the screen via the bus (optional).
Note: This method should only be implemented if the hardware has a physical Reset pin.
Avoid adding a Pin field to your DisplayBus wrapper for this purpose; use LCDResetOption
instead.
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.