1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! This library provides a very simple driver for the 5011as 7-segment display.
//! The layout for the pins is the following: https://components101.com/sites/default/files/component_pin/7-segment-display-pin-diagr_0.png
//!
//! This crate provides 2 drivers for the 5011as:
//! - [`LED5011AS`]\: Use this if all your pins have the same type (e.g. [`OutputPin<'_>`])
//! - [`GenericLED5011AS`]: Use this if your pins don't have the same type (e.g. [`OutputPin<'_>`] and `Flex<'_>` (from esp-hal))
//!
//! # Usage
//!
//! For this example I'm using an ESP32 with `esp-hal` with the [`LED5011AS`] driver.
//!
//! ```rust
//! // setup pins
//! let peripherals = esp_hal::init(config);
//!
//! let cfg = OutputConfig::default();
//!
//! let mut a = Output::new(peripherals.GPIO6, Level::Low, cfg);
//! let mut b = Output::new(peripherals.GPIO7, Level::Low, cfg);
//! let mut c = Output::new(peripherals.GPIO8, Level::Low, cfg);
//! let mut d = Output::new(peripherals.GPIO1, Level::Low, cfg);
//! let mut e = Output::new(peripherals.GPIO0, Level::Low, cfg);
//! let mut f = Output::new(peripherals.GPIO5, Level::Low, cfg);
//! let mut g = Output::new(peripherals.GPIO4, Level::Low, cfg);
//! let mut dp = Output::new(peripherals.GPIO10, Level::Low, cfg);
//!
//! // create LED5011AS
//! let mut display = LED5011AS::new(
//! &mut a,
//! &mut b,
//! &mut c,
//! &mut d,
//! &mut e,
//! &mut f,
//! &mut g,
//! &mut dp,
//! );
//!
//! // set a digit
//! display.set_digit(3)?;
//! display.set_digit(7)?; // overrides the '3' so you don't have to clear the display inbetween
//!
//! // clear the display
//! display.clear()?;
//!
//! // write a custom figure to the display
//! display.write_byte(0b01110111)?; // writes an 'A' to the display
//! ```
//!
//! [`OutputPin<'_>`]: embedded_hal::digital::OutputPin
pub use GenericLED5011AS;
pub use LED5011ASDriver;
pub use LED5011AS;
const DIGITS: = ;