embedded_display_controller/
dsi.rs1pub trait DsiHostCtrlIo {
2 type Error;
3
4 fn write(&mut self, command: DsiWriteCommand) -> Result<(), Self::Error>;
5 fn read(&mut self, command: DsiReadCommand, buf: &mut [u8]) -> Result<(), Self::Error>;
6}
7
8#[repr(u8)]
9#[derive(Debug)]
10pub enum DsiReadCommand {
11 DcsShort { arg: u8 } = 0x06,
12
13 GenericShortP0 = 0x04,
15 GenericShortP1 { arg0: u8 } = 0x14,
16 GenericShortP2 { arg0: u8, arg1: u8 } = 0x24,
17}
18
19impl DsiReadCommand {
20 pub fn discriminant(&self) -> u8 {
21 unsafe { *<*const _>::from(self).cast::<u8>() }
25 }
26}
27
28#[repr(u8)]
29#[derive(Debug)]
30pub enum DsiWriteCommand<'i> {
31 DcsShortP0 { arg: u8 } = 0x5,
32 DcsShortP1 { arg: u8, data: u8 } = 0x15,
33 DcsLongWrite { arg: u8, data: &'i [u8] } = 0x39,
34
35 GenericShortP0 = 0x03,
36 GenericShortP1 = 0x13,
37 GenericShortP2 = 0x23,
38 GenericLongWrite { arg: u8, data: &'i [u8] } = 0x29,
39
40 SetMaximumReturnPacketSize(u16) = 0x37,
41}
42
43impl<'i> DsiWriteCommand<'i> {
44 pub fn discriminant(&self) -> u8 {
45 unsafe { *<*const _>::from(self).cast::<u8>() }
49 }
50}