ST7567S Display Controller Driver

Crates.io Docs.rs

This crate provides a driver for the ST7567S display controller that can be used with Rust embedded projects.

Features

Notes

Examples

Direct write mode

```rust use st7567s::{ display::{DirectWriteMode, ST7567S}, interface::{I2CDisplayInterface, I2CInterface}, }; struct I2CStub; impl embedded_hal::blocking::i2c::Write for I2CStub { type Error = (); fn write(&mut self, _addr: u8, _buf: &[u8]) -> Result<(), ()> { Ok(()) } }

let i2c = I2CStub; let interface = I2CDisplayInterface::new(i2c); let mut display = ST7567S::new(interface); display.init().unwrap();

// Set all pixels to enabled state display .draw([0xff; 128 * 64 / 8].as_slice()) .unwrap();

```

Buffered mode + embedded_graphics

```rust use st7567s::{ display::{BufferedMode, ST7567S}, interface::{I2CDisplayInterface, I2CInterface}, }; use embeddedgraphics::{ monofont::{ascii::FONT6X10, MonoTextStyleBuilder}, pixelcolor::BinaryColor, prelude::*, text::{Baseline, Text}, }; struct I2CStub; impl embeddedhal::blocking::i2c::Write for I2CStub { type Error = (); fn write(&mut self, _addr: u8, _buf: &[u8]) -> Result<(), ()> { Ok(()) } }

let i2c = I2CStub; let interface = I2CDisplayInterface::new(i2c); let mut display = ST7567S::new(interface) .intobufferedgraphics_mode(); display.init().unwrap();

let textstyle = MonoTextStyleBuilder::new() .font(&FONT6X10) .text_color(BinaryColor::On) .build();

Text::withbaseline("Hello world!", Point::zero(), textstyle, Baseline::Top) .draw(&mut display) .unwrap();

Text::withbaseline("Hello Rust!", Point::new(0, 16), textstyle, Baseline::Top) .draw(&mut display) .unwrap();

display.flush().unwrap(); ```

Thanks ssd1306 driver for served as an example.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.