CommunicationInterface

Trait CommunicationInterface 

Source
pub trait CommunicationInterface {
    // Required methods
    fn init(&mut self) -> Result<(), MiniOledError>;
    fn write_command<const N: usize>(
        &mut self,
        buf: &CommandBuffer<N>,
    ) -> Result<(), MiniOledError>;
    fn write_data(&mut self, buf: &[u8]) -> Result<(), MiniOledError>;
}
Expand description

Trait representing the communication interface with the display.

This trait is implemented by I2cInterface and SPIInterface.

Required Methods§

Source

fn init(&mut self) -> Result<(), MiniOledError>

Initialize the communication device.

§Returns

Ok(()) on success, or a MiniOledError on failure.

Source

fn write_command<const N: usize>( &mut self, buf: &CommandBuffer<N>, ) -> Result<(), MiniOledError>

Send a command buffer to the device.

§Arguments
  • buf - The command buffer to send.
§Returns

Ok(()) on success, or a MiniOledError on failure.

Source

fn write_data(&mut self, buf: &[u8]) -> Result<(), MiniOledError>

Send data to the device.

§Arguments
  • buf - The data buffer to send.
§Returns

Ok(()) on success, or a MiniOledError on failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§