lcd_async/models/
st7796.rs1use embedded_graphics_core::pixelcolor::Rgb565;
2use embedded_hal_async::delay::DelayNs;
3
4use crate::{
5 dcs::SetAddressMode,
6 interface::{Interface, InterfaceKind},
7 models::{Model, ModelInitError},
8 options::ModelOptions,
9 ConfigurationError,
10};
11
12pub struct ST7796;
14
15impl Model for ST7796 {
16 type ColorFormat = Rgb565;
17 const FRAMEBUFFER_SIZE: (u16, u16) = (320, 480);
18
19 async fn init<DELAY, DI>(
20 &mut self,
21 di: &mut DI,
22 delay: &mut DELAY,
23 options: &ModelOptions,
24 ) -> Result<SetAddressMode, ModelInitError<DI::Error>>
25 where
26 DELAY: DelayNs,
27 DI: Interface,
28 {
29 if !matches!(
30 DI::KIND,
31 InterfaceKind::Serial4Line | InterfaceKind::Parallel8Bit | InterfaceKind::Parallel16Bit
32 ) {
33 return Err(ModelInitError::InvalidConfiguration(
34 ConfigurationError::UnsupportedInterface,
35 ));
36 }
37
38 super::ST7789.init(di, delay, options).await
39 }
40}