hcms-29xx

Crates.iohcms-29xx
lib.rshcms-29xx
version0.2.0
created_at2025-02-25 23:55:47.098204+00
updated_at2025-07-31 22:37:20.626801+00
descriptionPlatform agnostic driver for HCMS-29XX and HCMS-39XX display ICs
homepage
repositoryhttps://github.com/nonik0/hcms-29xx
max_upload_size
id1569828
size51,818
Nick Brown (nonik0)

documentation

README

HCMS-29xx Driver

Crates.io Crates.io docs.rs

lint build

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.

Features:

  • Single dependency on embedded-hal v1.0
  • 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:

Install

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"] }

How to Use

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();

TODO

  • Improve generic type interface, e.g. UnconfiguredPin improvements, better constructor, etc.
  • Katakana font
Commit count: 22

cargo fmt