st7305-lcd 0.2.0

Platform-independent no_std driver for the Sitronix ST7305 reflective LCD controller (embedded-hal 1.0, blocking and async)
Documentation
use crate::instr::Instr;

/// A command that can be sent with `write_command`: an opcode and its parameter bytes.
pub trait WriteCommand {
    /// Opcode, sent with `DC` low
    const OPCODE: Instr;
    /// Parameter bytes, sent with `DC` high
    type Params: AsRef<[u8]>;
    /// Parameter bytes of this command value.
    fn params(&self) -> Self::Params;
}

macro_rules! no_param_command {
    ($(#[$meta:meta])* $name:ident => $op:ident) => {
        #[doc = concat!("`", stringify!($op), "`: command without parameters.")]
        #[doc = ""]
        $(#[$meta])*
        #[derive(Clone, Copy, Debug, PartialEq, Eq)]
        pub struct $name;
        impl WriteCommand for $name {
            const OPCODE: Instr = Instr::$op;
            type Params = [u8; 0];
            fn params(&self) -> Self::Params { [] }
        }
    };
}

pub(crate) use no_param_command;