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.
- Single dependency on embedded-hal v1.0
- Optional dependency on avr-progmem for AVR targets to store font data in PROGMEM (requires nightly toolchain)
- Examples for:
- Arduino Uno, based on avr-hal
- ESP32-S3, based on esp-hal
To install this driver in your project, add the following line to your Cargo.toml
's dependencies
table:
hcms-29xx = "0.1.0"
For AVR targets:
hcms-29xx = { "0.1.0", features=["avr-progmem"] }
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.
- Improve function signatures, e.g. generic implementation for integer print functions
- Katakana font