2 releases

0.3.2 Nov 12, 2022
0.3.1 Nov 8, 2022

#1664 in Embedded development

21 downloads per month

MIT/Apache

17KB
277 lines

HX1230 Display driver

Early version of HX1230 display driver running on embedded-hal optionally integrated with embedded_graphics library

HX1320 display module

State of the library

The library is at an early state of development, but usable

What's working

  • communication with the HX1230 display using a SPI interface
  • integration with the embedded_graphics library

Caveats

  • embedded_graphics integration is only basic with no further optimizations for faster rendering
  • there is no driver variant using DMA channel for data transmission
  • unit tests are sparse (yet)

Examples

Library has been tested with STM32F103C8T6 microcontroller

To run example on such MCU, run

cargo run --example graphics --release

Usage

Initialize the display

// Create display driver using the provided SPI interface and chip select pin
let mut display = SpiDriver::new(&mut spi, &mut display_cs);

// Send the initialization sequence
display.initialize(&mut delay).unwrap();

// Create frame buffer for HX1230 display
let mut frame_buffer: ArrayDisplayBuffer = ArrayDisplayBuffer::new();

Do some drawing using embedded_graphics into buffer

let text_style = MonoTextStyle::new(&FONT_6X13, BinaryColor::On);

Text::new("example", Point::new(0, 12), text_style)
    .draw(&mut frame_buffer)
    .unwrap();

Send data to display

// Send display buffer data to display
display.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

License

Licensed under either of

at your option.

Resources

Python implementation of HX1230 display driver, including useful wiring information and even product datasheets: https://github.com/mcauser/micropython-hx1230

Dependencies

~165KB