use crate::{
dcs::{Dcs, SetAddressMode},
error::Error,
error::InitError,
options::ModelOptions,
};
use display_interface::WriteOnlyDataCommand;
use embedded_graphics_core::prelude::RgbColor;
use embedded_hal::{delay::DelayNs, digital::OutputPin};
mod gc9a01;
mod ili9341;
mod ili9342c;
mod ili934x;
mod ili9486;
mod st7735s;
mod st7789;
mod st7796;
pub use gc9a01::*;
pub use ili9341::*;
pub use ili9342c::*;
pub use ili9486::*;
pub use st7735s::*;
pub use st7789::*;
pub use st7796::*;
pub trait Model {
type ColorFormat: RgbColor;
const FRAMEBUFFER_SIZE: (u16, u16);
fn init<RST, DELAY, DI>(
&mut self,
dcs: &mut Dcs<DI>,
delay: &mut DELAY,
options: &ModelOptions,
rst: &mut Option<RST>,
) -> Result<SetAddressMode, InitError<RST::Error>>
where
RST: OutputPin,
DELAY: DelayNs,
DI: WriteOnlyDataCommand;
fn hard_reset<RST, DELAY>(
&mut self,
rst: &mut RST,
delay: &mut DELAY,
) -> Result<(), InitError<RST::Error>>
where
RST: OutputPin,
DELAY: DelayNs,
{
rst.set_low().map_err(InitError::Pin)?;
delay.delay_us(10);
rst.set_high().map_err(InitError::Pin)?;
Ok(())
}
fn write_pixels<DI, I>(&mut self, di: &mut Dcs<DI>, colors: I) -> Result<(), Error>
where
DI: WriteOnlyDataCommand,
I: IntoIterator<Item = Self::ColorFormat>;
}