Skip to content

Commit 3e7a568

Browse files
committed
cleanup
1 parent 690417f commit 3e7a568

File tree

5 files changed

+66
-15
lines changed

5 files changed

+66
-15
lines changed

Cargo.toml

+2-10
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,11 @@ authors = ["Nick Brown <nick@altonimb.us>"]
1111
categories = ["embedded", "no-std"]
1212
description = "Platform agnostic driver for HCMS-29XX and HCMS-39XX display ICs"
1313
keywords = ["embedded-hal-driver", "no-std"]
14-
license = "MIT"
14+
license = "MIT OR Apache-2.0"
1515
repository = "https://github.com/nonik0/hcms-29xx"
1616
readme = "README.md"
1717
autobins = false # needed to override for examples with own manifest files
1818

1919
[dependencies]
2020
embedded-hal = "1.0.0"
21-
avr-progmem = { version = "0.4.0", optional = true }
22-
23-
#[[example]]
24-
#name = "arduino-uno"
25-
#path = "examples/arduino-uno/src/main.rs"
26-
27-
[[example]]
28-
name = "esp32-s3"
29-
path = "examples/esp32-s3/src/bin/main.rs"
21+
avr-progmem = { version = "0.4.0", optional = true }

README.md

+64-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![lint](https://github.com/nonik0/hcms-29xx/actions/workflows/lint.yml/badge.svg)](https://github.com/nonik0/hcms-29xx/actions/workflows/lint.yml)
88
[![build](https://github.com/nonik0/hcms-29xx/actions/workflows/build.yml/badge.svg)](https://github.com/nonik0/hcms-29xx/actions/workflows/build.yml)
99

10-
Platform agnostic driver for [HCMS-29XX](https://docs.broadcom.com/doc/HCMS-29xx-Series-High-Performance-CMOS-5-x-7-Alphanumeric-Displays) and [HCMS-39XX](https://docs.broadcom.com/doc/AV02-0868EN) display ICs. Many thanks for @Andy4495's existing [HCMS39XX](https://github.com/Andy4495/HCMS39xx) Arduino/C++ library, which I used for a reference implementation as well as for the font data.
10+
A platform agnostic driver for [HCMS-29XX](https://docs.broadcom.com/doc/HCMS-29xx-Series-High-Performance-CMOS-5-x-7-Alphanumeric-Displays) and [HCMS-39XX](https://docs.broadcom.com/doc/AV02-0868EN) display ICs. Many thanks to @Andy4495's existing [HCMS39xx](https://github.com/Andy4495/HCMS39xx) Arduino/C++ library, which I used as a reference implementation as well as for the font data.
1111

1212
## Features:
1313
* Single dependency on embedded-hal v1.0
@@ -17,7 +17,7 @@ Platform agnostic driver for [HCMS-29XX](https://docs.broadcom.com/doc/HCMS-29xx
1717
* ESP32-S3 using [esp-hal](https://github.com/esp-rs/esp-hal)
1818

1919
## Install
20-
To install this driver in your project add the following line to your `Cargo.toml`'s `dependencies` table:
20+
To install this driver in your project, add the following line to your `Cargo.toml`'s `dependencies` table:
2121

2222
```toml
2323
hcms-29xx = "0.1.0"
@@ -26,7 +26,68 @@ hcms-29xx = "0.1.0"
2626
For AVR targets:
2727

2828
```toml
29-
hcms-29xx { "0.1.0", features=["avr-progmem"] }
29+
hcms-29xx = { "0.1.0", features=["avr-progmem"] }
30+
```
31+
32+
## How to Use
33+
34+
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.
35+
36+
Specifying only required pins:
37+
38+
```rust
39+
const NUM_CHARS: usize = 8;
40+
41+
let mut display = hcms_29xx::Hcms29xx::<NUM_CHARS, _, _, _, _>::new(
42+
HalOutputPin1, // Data pin
43+
HalOutputPin2, // RS pin
44+
HalOutputPin3, // Clock pin
45+
HalOutputPin4, // CE pin
46+
UnconfiguredPin, // Optional: Blank pin
47+
UnconfiguredPin, // Optional: OscSel pin
48+
UnconfiguredPin, // Optional: Reset pin
49+
)
50+
.unwrap();
51+
52+
display.begin().unwrap();
53+
display.display_unblank().unwrap();
54+
display
55+
.set_peak_current(hcms_29xx::PeakCurrent::Max12_8Ma)
56+
.unwrap();
57+
display.set_brightness(15).unwrap();
58+
display.print_ascii_bytes(b"hello!").unwrap();
59+
```
60+
61+
Specifying all pins:
62+
63+
```rust
64+
const NUM_CHARS: usize = 8;
65+
66+
let mut display = hcms_29xx::Hcms29xx::<NUM_CHARS, _, _, _, _, _, _, _>::new(
67+
HalOutputPin1, // Data pin
68+
HalOutputPin2, // RS pin
69+
HalOutputPin3, // Clock pin
70+
HalOutputPin4, // CE pin
71+
HalOutputPin5, // Optional: Blank pin
72+
HalOutputPin6, // Optional: OscSel pin
73+
HalOutputPin7, // Optional: Reset pin
74+
)
75+
.unwrap();
76+
77+
display.begin().unwrap();
78+
display.display_unblank().unwrap();
79+
display.print_ascii_bytes(b"goodbye!").unwrap();
80+
```
81+
82+
## Examples
83+
84+
There are currently two included examples:
85+
- [Arduino Uno](examples/arduino-uno/), based on [avr-hal](https://github.com/Rahix/avr-hal/)
86+
- [ESP32-S3](examples/esp32-s3/), based on [esp-hal](https://github.com/esp-rs/esp-hal).
87+
88+
Follow the appropriate documentation for each HAL for the prerequisite set up and then simply use cargo to build and/or run each.
3089

3190
## TODO
91+
- [ ] Improve generic type interface, e.g. UnconfiguredPin improvements, better constructor, etc.
92+
- [ ] Improve function signatures, e.g. generic implementation for integer print functions
3293
- [ ] Katakana font

examples/esp32-s3/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = "2021"
66

77
[[bin]]
88
name = "esp32-s3"
9-
path = "src/bin/main.rs"
109

1110
[dependencies]
1211
critical-section = "1.2.0"

examples/esp32-s3/src/lib.rs

-1
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)