A platform agnostic driver for HCMS-29xx and HCMS-39xx display ICs. Many thanks to @Andy4495's existing HCMS39xx Arduino/C++ library, which I used as a reference implementation as well as for the font data.
- Using embedded-hal v1.0 traits for maximum compatibility with embedded platforms
- Support for printing integer values and (optionally) float values
- Optional dependency on avr-progmem for AVR targets to store font data in PROGMEM (requires nightly toolchain)
- Examples for:
To install this driver in your project, add the following line to your Cargo.toml's dependencies table:
hcms-29xx = "0.2.0"For AVR targets:
hcms-29xx = { version = "0.2.0", features = ["avr-progmem"] }For projects needing float support (increases binary size, avoid using on MCUs without native float support):
hcms-29xx = { version = "0.2.0", features = ["print_float"] }The HCMS-29xx/HCMS-39xx displays require a minimum of four pins to control: Data (Din), Register Select (RS), Clock (CLK), and Chip Enable (CE). The other pins, Blank (BL), Oscillator Select (SEL), and Reset (RST), are optional. If not given, the optional pins' logic levels must be set appropriately, typically BL low, SEL high, and RST high.
Specifying only required pins:
const NUM_CHARS: usize = 8;
let mut display = hcms_29xx::Hcms29xx::<NUM_CHARS, _, _, _, _>::new(
HalOutputPin1, // Data pin
HalOutputPin2, // RS pin
HalOutputPin3, // Clock pin
HalOutputPin4, // CE pin
UnconfiguredPin, // Optional: Blank pin
UnconfiguredPin, // Optional: OscSel pin
UnconfiguredPin, // Optional: Reset pin
)
.unwrap();
display.begin().unwrap();
display.display_unblank().unwrap();
display
.set_peak_current(hcms_29xx::PeakCurrent::Max12_8Ma)
.unwrap();
display.set_brightness(15).unwrap();
display.print_ascii_bytes(b"hello!").unwrap();Specifying all pins:
const NUM_CHARS: usize = 8;
let mut display = hcms_29xx::Hcms29xx::<NUM_CHARS, _, _, _, _, _, _, _>::new(
HalOutputPin1, // Data pin
HalOutputPin2, // RS pin
HalOutputPin3, // Clock pin
HalOutputPin4, // CE pin
HalOutputPin5, // Optional: Blank pin
HalOutputPin6, // Optional: OscSel pin
HalOutputPin7, // Optional: Reset pin
)
.unwrap();
display.begin().unwrap();
display.display_unblank().unwrap();
display.print_ascii_bytes(b"goodbye!").unwrap();- Improve generic type interface, e.g. UnconfiguredPin improvements, better constructor, etc.
- Katakana font