This library contains a driver for E-Paper Modules with Controller GDE021A1 ((172x72 B/W Pixel via SPI)).
It uses the embedded graphics library for the optional graphics support.
A 2018-edition compatible version (Rust 1.31+) is needed.
For example, the initialize sequence is like (on a Cortex MCU, using the embedded hal crate)
Set the default compile target in e.g .cargo/config file to
config
[build]
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
in order to support Cortex-M0.
```Rust
let dp = pac::Peripherals::take().unwrap();
let cp = cortex_m::Peripherals::take().unwrap();
// Configure the clock.
let mut rcc = dp.RCC.freeze(Config::hsi16());
// Acquire the GPIOx peripheral.
// This also enables the clock for GPIOx in the RCC register.
let gpioa = dp.GPIOA.split(&mut rcc);
let gpiob = dp.GPIOB.split(&mut rcc);
// The GPIO's
let chip_sel = gpioa.pa15.into_push_pull_output();
let data_cmd = gpiob.pb11.into_push_pull_output();
let reset = gpiob.pb2.into_push_pull_output();
let busy = gpiob.pb8.into_pull_up_input();
// The SPI
let mosi = gpiob.pb5;
let clk = gpiob.pb3;
let spi = dp.SPI1.spi((clk, NoMiso, mosi), MODE_0, 1_000_000.hz(), &mut rcc);
// the time delay
let mut delay = cp.SYST.delay(rcc.clocks);
// and finally the display structure
let mut disp = GDE021A1::new(spi, reset, Some(chip_sel), data_cmd, busy);
// initialize the display
disp.init(&mut delay).expect("could not init display");
```
Once the display is initialized it can be used using the embedded graphics library like e.g. like
```Rust // all pixels turn white disp.clear();
// draw some fancy stuff and graphics via embedded graphics api
let elem = Circle::new(Point::new(140, 36), 25)
.into_styled(PrimitiveStyle::with_fill(BinaryColor::On));
elem.draw(&mut disp);
let elem = Text::new("Hello Rust!", Point::new(1, 8))
.into_styled(TextStyle::new(Font6x8, BinaryColor::On));
elem.draw(&mut disp);
// refresh the epaper
disp.refresh(&mut delay).expect("could not flush display");
```
The embedded target is most likely very different from the host. and pre-configured in your .cargo/config file. However, test (specifically in CI environment run on host)
Thus, tests can savely run by specifying your host target like
shell
cargo test --target=x86_64-unknown-linux-gnu
| Interface | Description | | :---: | :--- | | DIN | SPI MOSI | | CLK | SPI SCK | | CS | SPI chip select (Low active)- optional | | DC | Data/Command control pin (High for data, and low for command) | | RST | External reset pin (Low for reset) | | BUSY | Busy state output pin (Low for busy) |