Skip to main content

display_driver/bus/
display_interface_impl.rs

1//! Implementation of `SimpleDisplayBus` for `display-interface` traits.
2
3use super::{ErrorType, SimpleDisplayBus};
4use display_interface::{AsyncWriteOnlyDataCommand, DataFormat, DisplayError};
5
6impl<DI: AsyncWriteOnlyDataCommand> ErrorType for DI {
7    type Error = DisplayError;
8}
9
10impl<DI: AsyncWriteOnlyDataCommand> SimpleDisplayBus for DI {
11    async fn write_cmds(&mut self, cmds: &[u8]) -> Result<(), Self::Error> {
12        self.send_commands(DataFormat::U8(cmds)).await
13    }
14
15    async fn write_data(&mut self, data: &[u8]) -> Result<(), Self::Error> {
16        self.send_data(DataFormat::U8(data)).await
17    }
18}