| Crates.io | hcms-29xx |
| lib.rs | hcms-29xx |
| version | 0.2.0 |
| created_at | 2025-02-25 23:55:47.098204+00 |
| updated_at | 2025-07-31 22:37:20.626801+00 |
| description | Platform agnostic driver for HCMS-29XX and HCMS-39XX display ICs |
| homepage | |
| repository | https://github.com/nonik0/hcms-29xx |
| max_upload_size | |
| id | 1569828 |
| size | 51,818 |
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.
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();