From c07aa9f0c068200d80f6635c221dd7480e53766a Mon Sep 17 00:00:00 2001 From: Agathe Porte Date: Sun, 23 Feb 2020 10:30:59 +0100 Subject: custom chars support --- examples/custom_char.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/custom_char.rs (limited to 'examples') diff --git a/examples/custom_char.rs b/examples/custom_char.rs new file mode 100644 index 0000000..059f173 --- /dev/null +++ b/examples/custom_char.rs @@ -0,0 +1,23 @@ +use charlcd::custom_char; +use charlcd::Screen; +use std::io::Write; + +fn main() -> std::io::Result<()> { + let mut screen = Screen::default()?; + + // Alarm symbol + screen.custom_char(0, [0x04, 0x0E, 0x0E, 0x0E, 0x0E, 0x1F, 0x04, 0x00])?; + + screen.custom_char(1, custom_char::RIGHT_ARROW)?; + screen.custom_char(2, custom_char::LEFT_ARROW)?; + screen.custom_char(3, custom_char::UP_ARROW)?; + screen.custom_char(4, custom_char::DOWN_ARROW)?; + + screen.clear()?; + screen.write(b"\x00 Alarm 10:00\n")?; + screen.write(b"\x01\x02 X Arrows\n")?; + screen.write(b"\x03\x04 Y Arrow")?; + screen.flush()?; + + Ok(()) +} -- cgit v1.2.3