summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAgathe Porte <microjoe@microjoe.org>2020-02-23 10:30:59 +0100
committerAgathe Porte <microjoe@microjoe.org>2020-02-23 11:37:50 +0100
commitc07aa9f0c068200d80f6635c221dd7480e53766a (patch)
tree8b454142169036e1b4be38289e46e9b76bdfd9dd /examples
parentbc0e5a406a0179fdbc7a5e298d108e966bcb3ed0 (diff)
downloadcharlcd-c07aa9f0c068200d80f6635c221dd7480e53766a.tar.gz
charlcd-c07aa9f0c068200d80f6635c221dd7480e53766a.zip
custom chars support
Diffstat (limited to 'examples')
-rw-r--r--examples/custom_char.rs23
1 files changed, 23 insertions, 0 deletions
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(())
+}