pub const fn from_ascii_byte(byte: u8) -> u8
Expand description
Converts an ASCII
byte to a 7-segment display byte.
Unknown characters are converted to 0
(all segments off).
§Note
Rust strings are UTF-8
encoded, so what you see as a single character may be multiple bytes.
§Example
Display Err
text on a 4-digit display:
use tm1637_embedded_hal::{mappings::from_ascii_byte, mock::Noop, TM1637Builder};
let mut tm = TM1637Builder::new(Noop, Noop, Noop).build_blocking::<4>();
tm.init().ok();
let err = "Err".as_bytes().iter().copied().map(from_ascii_byte);
tm.display(0, err).ok();