1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use address::Address; const SECOND_LINE_ADDRESS: u8 = 0x40; /// This trait is used to specify the start address of the display data RAM. pub trait Home { const FIRST_LINE_ADDRESS: u8 = 0x00; } /// Enumeration of default lines. pub enum DefaultLines { One, Two, } impl Home for DefaultLines {} impl From<DefaultLines> for Address { /// Returns the hardware address of the line. fn from(line: DefaultLines) -> Self { let raw_addr = match line { DefaultLines::One => DefaultLines::FIRST_LINE_ADDRESS, DefaultLines::Two => SECOND_LINE_ADDRESS, }; Address::from(raw_addr) } }