pub trait Hardware {
// Required methods
fn rs(&mut self, bit: bool);
fn enable(&mut self, bit: bool);
fn data(&mut self, data: u8);
// Provided methods
fn wait_address(&mut self) { ... }
fn mode(&self) -> FunctionMode { ... }
fn can_read(&self) -> bool { ... }
fn rw(&mut self, _bit: bool) { ... }
fn read_data(&mut self) -> u8 { ... }
fn apply(&mut self) { ... }
}
Required Methods§
fn rs(&mut self, bit: bool)
fn enable(&mut self, bit: bool)
fn data(&mut self, data: u8)
Provided Methods§
Sourcefn wait_address(&mut self)
fn wait_address(&mut self)
Address set up time is 40ns minimum (tAS) This function should be overridden in case processor is too fast for 40ns to pass.
Sourcefn mode(&self) -> FunctionMode
fn mode(&self) -> FunctionMode
Override to pick 8-bit mode (4-bit mode by default)
Sourcefn can_read(&self) -> bool
fn can_read(&self) -> bool
If this implementation can read from the data port. Default is false
. If true
is
returned, both rw
and read_data
need to be implemented.
Sourcefn rw(&mut self, _bit: bool)
fn rw(&mut self, _bit: bool)
Set R/W flag.
Implementation should re-configure GPIO for input before setting R/W pin to true
and configure GPIO for output after setting R/W to false
.
Note that LCD driver typically uses 5V, so input should be tolerant to 5V when using busy flag.
Default implementation will panic.