hx1230

Crates.iohx1230
lib.rshx1230
version0.3.2
sourcesrc
created_at2022-11-08 19:05:10.826286
updated_at2022-11-12 16:43:20.540918
descriptionDriver for the HX1230 display
homepage
repositoryhttps://github.com/viktorchvatal/hx1230
max_upload_size
id708228
size42,176
Viktor Chvátal (viktorchvatal)

documentation

README

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

Commit count: 10

cargo fmt