pub struct Interface<SPI, CS, BUSY, DC, RESET> { /* private fields */ }
Expand description

The hardware interface to a display.

Example

This example uses the Linux implementation of the embedded HAL traits to build a display interface. For a complete example see the Raspberry Pi Inky pHAT example.

extern crate linux_embedded_hal;
use linux_embedded_hal::spidev::{self, SpidevOptions};
use linux_embedded_hal::sysfs_gpio::Direction;
use linux_embedded_hal::Delay;
use linux_embedded_hal::{Pin, Spidev};

extern crate ssd1675;
use ssd1675::{Builder, Color, Dimensions, Display, GraphicDisplay, Rotation};

// Configure SPI
let mut spi = Spidev::open("/dev/spidev0.0").expect("SPI device");
let options = SpidevOptions::new()
    .bits_per_word(8)
    .max_speed_hz(4_000_000)
    .mode(spidev::SPI_MODE_0)
    .build();
spi.configure(&options).expect("SPI configuration");

// https://pinout.xyz/pinout/inky_phat
// Configure Digital I/O Pins
let cs = Pin::new(8); // BCM8
cs.export().expect("cs export");
while !cs.is_exported() {}
cs.set_direction(Direction::Out).expect("CS Direction");
cs.set_value(1).expect("CS Value set to 1");

let busy = Pin::new(17); // BCM17
busy.export().expect("busy export");
while !busy.is_exported() {}
busy.set_direction(Direction::In).expect("busy Direction");

let dc = Pin::new(22); // BCM22
dc.export().expect("dc export");
while !dc.is_exported() {}
dc.set_direction(Direction::Out).expect("dc Direction");
dc.set_value(1).expect("dc Value set to 1");

let reset = Pin::new(27); // BCM27
reset.export().expect("reset export");
while !reset.is_exported() {}
reset
    .set_direction(Direction::Out)
    .expect("reset Direction");
reset.set_value(1).expect("reset Value set to 1");

// Build the interface from the pins and SPI device
let controller = ssd1675::Interface::new(spi, cs, busy, dc, reset);

Implementations

Create a new Interface from embedded hal traits.

Trait Implementations

Reset the controller.

Send a command to the controller. Read more

Send data for a command.

Wait for the controller to indicate it is not busy.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Casts the value.

OverflowingCasts the value.

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.