[][src]Struct rpi_memory_display::MemoryDisplay

pub struct MemoryDisplay { /* fields omitted */ }

Sharp Memory Display

Implementations

impl MemoryDisplay[src]

pub fn new(
    spi_bus: Bus,
    spi_ss: SlaveSelect,
    cs_pin: u8,
    width: usize,
    height: u8
) -> Result<Self>
[src]

Initializes a new MemoryDisplay. The spi_ss pin should be left disconnected (but will still get toggled by the hardware). It is replaced by the cs GPIO pin.

pub fn set_clock_speed(&mut self, clock_hz: u32) -> Result<()>[src]

Sets the SPI clock frequency in Hz.

Default value is 2Mhz (2000000). The spec for the Memory Display states a typical clock speed of 1Mhz, and a maximum speed of 2Mhz. The screens often do respond at a higher speed (e.g. 8MHz) but that will raise the internal temperatures and may lower the functional life of your screen.

pub fn clock_speed(&self) -> Result<u32>[src]

Gets the SPI clock frequency in Hz.

pub fn set_spidev_bufsiz(&mut self, spidev_bufsiz: usize)[src]

Sets the SPI device buffer size (as configured by the spidev.bufsiz option in boot/cmdline.txt on the Raspberry Pi).

You can read the current spidev.bufsiz by doing: cat /sys/module/spidev/parameters/bufsiz

The default value for the Pi (and this library) is 4096 bytes.

pub fn spidev_bufsiz(&self) -> usize[src]

Gets the currently configured spidev.bufsiz for this library only. To get the real configured value for the hardware read /sys/module/spidev/parameters/bufsiz.

pub fn clear(&mut self) -> Result<()>[src]

Clears the screen.

pub fn update<T: AsRef<[u8]>>(&mut self, pixels: T) -> Result<()>[src]

Updates the display. Only lines that have changed since the last clear/update/refresh are sent to the display.

The pixels buffer can be any u8 slice where each bit represents a single black/white pixel (8 pixels per u8). MemoryDisplayBuffer provides a convenient interface to such a buffer.

Trait Implementations

impl Debug for MemoryDisplay[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.