From efd3048e098d3157774e3f39baeb7246f65423ff Mon Sep 17 00:00:00 2001 From: Agathe Porte Date: Thu, 27 Feb 2020 18:26:56 +0100 Subject: first try at documenting custom_char module --- src/lib.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index e69ade8..23c7830 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; -- cgit v1.2.3