use core::marker::Sized;
use embedded_hal::{delay::DelayNs, digital::*, spi::SpiDevice};
pub(crate) trait Command {
fn address(self) -> u8;
}
pub(crate) trait EEIInit<SPI, CS, RST, DELAY>
where
SPI: SpiDevice,
CS: OutputPin,
RST: OutputPin,
DELAY: DelayNs,
{
fn init(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error>;
}
pub trait EEIDisplay<SPI, CS, RST, DELAY>
where
SPI: SpiDevice,
CS: OutputPin,
RST: OutputPin,
DELAY: DelayNs,
{
type DisplayColor;
fn new(spi: &mut SPI, cs: CS, rst: RST, delay: &mut DELAY) -> Result<Self, SPI::Error>
where
Self: Sized;
fn sleep(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error>;
fn wake_up(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error>;
fn width(&self) -> u32;
fn height(&self) -> u32;
fn set_brightness(&mut self, spi: &mut SPI, val: u32) -> Result<(), SPI::Error>;
fn update_frame(
&mut self,
spi: &mut SPI,
buffer: &[u8],
delay: &mut DELAY,
) -> Result<(), SPI::Error>;
fn update_partial_frame(
&mut self,
spi: &mut SPI,
buffer: &[u8],
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), SPI::Error>;
fn clear_frame(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error>;
}