summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
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 /src/lib.rs
parentbc0e5a406a0179fdbc7a5e298d108e966bcb3ed0 (diff)
downloadcharlcd-c07aa9f0c068200d80f6635c221dd7480e53766a.tar.gz
charlcd-c07aa9f0c068200d80f6635c221dd7480e53766a.zip
custom chars support
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b573b1a..6b1d6e1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,5 @@
mod codes;
+pub mod custom_char;
mod of_node;
use std::fs::{File, OpenOptions};
@@ -288,6 +289,17 @@ where
write_simple_code!(self, SpecialCode::LargeFont)
}
+ /// Custom character create
+ pub fn custom_char(&mut self, code: u8, value: [u8; 8]) -> std::io::Result<()> {
+ let mut res = 0u64;
+ let mut i = 0;
+ for b in value.iter().rev() {
+ res |= (*b as u64) << i;
+ i += 8;
+ }
+ write_simple_code!(self, SpecialCode::Generator(code, res))
+ }
+
pub fn gotoxy(&mut self, x: u32, y: u32) -> std::io::Result<()> {
write_simple_code!(self, SpecialCode::GotoXY(Some(x), Some(y)))
}