diff options
author | Agathe Porte <microjoe@microjoe.org> | 2020-02-27 18:26:56 +0100 |
---|---|---|
committer | Agathe Porte <microjoe@microjoe.org> | 2020-02-27 18:26:56 +0100 |
commit | efd3048e098d3157774e3f39baeb7246f65423ff (patch) | |
tree | 328d34366bc523c6128e3219450e765ebb5f97ca /src/lib.rs | |
parent | d01183e06c75a2a9d4ce619b63b808258cd7c100 (diff) | |
download | charlcd-efd3048e098d3157774e3f39baeb7246f65423ff.tar.gz charlcd-efd3048e098d3157774e3f39baeb7246f65423ff.zip |
first try at documenting custom_char module
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -762,7 +762,36 @@ where write_simple_code!(self, SpecialCode::LargeFont) } - /// Custom character create + /// Store a custom character into the screen memory for future usage. + /// + /// See also [`custom_char`] module for a global explanation on how to + /// declare custom characters, as well as a list of already defined custom + /// characters. + /// + /// # Example + /// + /// ```no_run + /// extern crate charlcd; + /// + /// use std::io::Write; + /// use charlcd::{Screen, custom_char}; + /// + /// fn main() -> std::io::Result<()> { + /// let mut screen = Screen::default()?; + /// + /// screen.reinit()?; + /// + /// // Store the custom ▸ character in the screen memory, code 0 + /// screen.custom_char(0, custom_char::RIGHT_ARROW)?; + /// + /// // Print custom character from screen memory, code 0 + /// screen.write(b"\x00")?; + /// screen.flush()?; + /// + /// Ok(()) + /// } + /// ``` + /// pub fn custom_char(&mut self, code: u8, value: [u8; 8]) -> std::io::Result<()> { let mut res = 0u64; let mut i = 0; |