Skip to content

Commit 663d73b

Browse files
committed
cleanup
1 parent 690417f commit 663d73b

File tree

5 files changed

+56
-13
lines changed

5 files changed

+56
-13
lines changed

Cargo.toml

+1-9
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,4 @@ 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

+55-2
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 for a reference implementation as well as for the font data.
1111

1212
## Features:
1313
* Single dependency on embedded-hal v1.0
@@ -26,7 +26,60 @@ 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, their logic levels must be set appropriately, e.g. BL low, SEL high, and RST high.
35+
36+
Specifying only required pins:
37+
38+
```rust
39+
let mut display = hcms_29xx::Hcms29xx::<NUM_CHARS, _, _, _, _>::new(
40+
HalOutputPin1, // Data pin
41+
HalOutputPin2, // RS pin
42+
HalOutputPin3, // Clock pin
43+
HalOutputPin4, // CE pin
44+
UnconfiguredPin, // Optional: Blank pin
45+
UnconfiguredPin, // Optional: OscSel pin
46+
UnconfiguredPin, // Optional: Reset pin
47+
)
48+
.unwrap();
49+
50+
display.begin().unwrap();
51+
display.display_unblank().unwrap();
52+
display
53+
.set_peak_current(hcms_29xx::PeakCurrent::Max12_8Ma)
54+
.unwrap();
55+
display.set_brightness(15).unwrap();
56+
display.print_ascii_bytes(b"hello!").unwrap();
57+
```
58+
59+
Specifying all pins:
60+
61+
```rust
62+
let mut display = hcms_29xx::Hcms29xx::<NUM_CHARS, _, _, _, _, _, _, _>::new(
63+
HalOutputPin1, // Data pin
64+
HalOutputPin2, // RS pin
65+
HalOutputPin3, // Clock pin
66+
HalOutputPin4, // CE pin
67+
HalOutputPin5, // Optional: Blank pin
68+
HalOutputPin6, // Optional: OscSel pin
69+
HalOutputPin7, // Optional: Reset pin
70+
)
71+
.unwrap();
72+
73+
display.begin().unwrap();
74+
display.display_unblank().unwrap();
75+
display.print_ascii_bytes(b"goodbye!").unwrap();
76+
```
77+
78+
## Examples
79+
80+
There are currently two included examples. One is for Arduino Uno, based on [avr-hal](https://github.com/Rahix/avr-hal/) and the other is for ESP32-S3, based on [esp-hal](https://github.com/esp-rs/esp-hal). Follow the appropriate documentation for each HAL to get an environment set up and simply run "cargo build
3081

3182
## TODO
83+
- [ ] Improve generic type interface, e.g. UnconfiguredPin improvements, better constructor, etc.
84+
- [ ] Improve function signatures, e.g. generic implementation for integer print functions
3285
- [ ] 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)