Early version of HX1230 display driver running on embedded-hal
optionally
integrated with embedded_graphics
library
The library is at an early state of development, but usable
embedded_graphics
libraryembedded_graphics
integration is only basic with no further optimizations for faster renderingLibrary has been tested with STM32F103C8T6 microcontroller
To run example on such MCU, run
cargo run --example graphics --release
Initialize the display
rust
let mut driver = SpiDriver::new(&mut spi, &mut display_cs);
display.send_commands(&[command::reset()])?;
delay.delay_us(100_u16);
display.send_commands(init_sequence())?;
Create the frame buffer
rust
let mut frame_buffer: ArrayDisplayBuffer = ArrayDisplayBuffer::new();
Draw primitives using embedded_graphics
into buffer
```rust let textstyle = MonoTextStyle::new(&FONT6X13, BinaryColor::On);
Text::new("example", Point::new(0, 12), textstyle) .draw(&mut framebuffer) .unwrap(); ```
Send data to display
rust
let mut driver = SpiDriver::new(&mut spi, &mut display_cs);
driver.send_buffer(&frame_buffer).unwrap();
Full example code: examples/graphics.rs
Note:
- openocd must be running to successfully run the example
- MCU memory layout must match the one specified in the memory.x
file
- GDB must successfully apply .gdbinit
file present in the root crate directory
To run unit tests on the local machine (change the target in case of different platform)
test --lib --target x86_64-unknown-linux-gnu
Licensed under either of
at your option.
Python implementation of HX1230 display driver, including useful wiring information and even product datasheets: https://github.com/mcauser/micropython-hx1230