Struct Lcd

Source
pub struct Lcd<'a, 'b, Sender, Delayer, const READABLE: bool>
where Delayer: DelayNs,
{ /* private fields */ }
Expand description

Lcd is the main struct to drive a LCD1602

Implementations§

Source§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Lcd<'a, 'b, Sender, Delayer, READABLE>
where Sender: SendCommand<Delayer, READABLE>, Delayer: DelayNs,

Source

pub fn new( sender: &'a mut Sender, delayer: &'b mut Delayer, config: Config, poll_interval_us: Option<u32>, ) -> Self

Create a Lcd driver, and init LCD hardware

If we don’t specify poll_interval_us,
then default value will be 40 us for Write-Only mode, and 10 us for Read-Write mode

Trait Implementations§

Source§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Anim for Lcd<'a, 'b, Sender, Delayer, READABLE>
where Delayer: DelayNs, Sender: SendCommand<Delayer, READABLE>,

Make the entire screen blink Read more
Source§

fn typewriter_write(&mut self, str: &str, delay_us: u32)

Typewriter-style display Read more
Source§

fn split_flap_write( &mut self, str: &str, fs: FlipStyle, max_flip_cnt: Option<u8>, per_flip_delay_us: u32, per_char_flip_delay_us: Option<u32>, )

Split-Flap-style display Read more
Source§

fn shift_display_to_pos( &mut self, target_pos: u8, ms: MoveStyle, display_state_when_shift: State, delay_us_per_step: u32, )

Move the display window to the specified position (measured from the upper-left corner of the display) Read more
Source§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Basic for Lcd<'a, 'b, Sender, Delayer, READABLE>
where Sender: SendCommand<Delayer, READABLE>, Delayer: DelayNs,

Source§

fn set_backlight(&mut self, backlight: State)

Note: Due to driver implementation, this function may have actual effect, or not
Source§

fn get_backlight(&self) -> State

Source§

fn write_byte_to_cur(&mut self, byte: u8)

Source§

fn write_graph_to_cgram(&mut self, index: u8, graph_data: &CGRAMGraph)

Note:
We allow write Font5x11 graph even under Font5x8 mode.
Source§

fn clean_display(&mut self)

Source§

fn return_home(&mut self)

Source§

fn set_line_mode(&mut self, line: LineMode)

Source§

fn get_line_mode(&self) -> LineMode

Source§

fn set_font(&mut self, font: Font)

Source§

fn get_font(&self) -> Font

Source§

fn set_display_state(&mut self, display: State)

Source§

fn get_display_state(&self) -> State

Source§

fn set_cursor_state(&mut self, cursor: State)

Source§

fn get_cursor_state(&self) -> State

Source§

fn get_ram_type(&self) -> RAMType

Source§

fn set_direction(&mut self, dir: MoveDirection)

Source§

fn get_direction(&self) -> MoveDirection

Source§

fn set_shift_type(&mut self, shift: ShiftType)

Source§

fn get_shift_type(&self) -> ShiftType

Source§

fn set_cursor_pos(&mut self, pos: (u8, u8))

Source§

fn set_cgram_addr(&mut self, addr: u8)

Source§

fn get_cursor_pos(&self) -> (u8, u8)

Source§

fn shift_cursor_or_display(&mut self, shift_type: ShiftType, dir: MoveDirection)

Source§

fn get_display_offset(&self) -> u8

Source§

fn set_poll_interval(&mut self, interval_us: u32)

Source§

fn get_poll_interval_us(&self) -> u32

Source§

fn get_line_capacity(&self) -> u8

Source§

fn calculate_pos_by_offset(&self, start: (u8, u8), offset: (i8, i8)) -> (u8, u8)

Source§

fn delay_ms(&mut self, ms: u32)

Wait for specified milliseconds
Source§

fn delay_us(&mut self, us: u32)

Wait for specified microseconds
Source§

impl<'a, 'b, Sender, Delayer> BasicRead for Lcd<'a, 'b, Sender, Delayer, true>
where Sender: SendCommand<Delayer, true>, Delayer: DelayNs,

Source§

fn read_u8_from_cur(&mut self) -> u8

Source§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Ext for Lcd<'a, 'b, Sender, Delayer, READABLE>
where Delayer: DelayNs, Sender: SendCommand<Delayer, READABLE>,

Source§

fn toggle_display(&mut self)

toggle entire display on and off (it doesn’t toggle backlight)
Source§

fn write_char_to_cur(&mut self, char: char)

write char to current position In default implementation, character only support from ASCII 0x20 (white space) to ASCII 0x7D (})
Source§

fn write_str_to_cur(&mut self, str: &str)

write string to current position
Source§

fn write_byte_to_pos(&mut self, byte: u8, pos: (u8, u8))

write a byte to specific position
Source§

fn write_char_to_pos(&mut self, char: char, pos: (u8, u8))

write a char to specific position
Source§

fn write_str_to_pos(&mut self, str: &str, pos: (u8, u8))

write string to specific position
Source§

fn write_graph_to_cur(&mut self, index: u8)

write custom graph to current position Read more
Source§

fn write_graph_to_pos(&mut self, index: u8, pos: (u8, u8))

write custom graph to specific position Read more
Source§

fn offset_cursor_pos(&mut self, offset: (i8, i8))

change cursor position with relative offset
Source§

impl<'a, 'b, Sender, Delayer> ExtRead for Lcd<'a, 'b, Sender, Delayer, true>
where Delayer: DelayNs, Sender: SendCommand<Delayer, true>,

Source§

fn read_byte_from_pos(&mut self, pos: (u8, u8)) -> u8

read a byte from specific position
Source§

fn read_graph_from_cgram(&mut self, index: u8) -> CGRAMGraph

read custom graph data from CGRAM Read more

Auto Trait Implementations§

§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Freeze for Lcd<'a, 'b, Sender, Delayer, READABLE>

§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> RefUnwindSafe for Lcd<'a, 'b, Sender, Delayer, READABLE>
where Sender: RefUnwindSafe, Delayer: RefUnwindSafe,

§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Send for Lcd<'a, 'b, Sender, Delayer, READABLE>
where Sender: Send, Delayer: Send,

§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Sync for Lcd<'a, 'b, Sender, Delayer, READABLE>
where Sender: Sync, Delayer: Sync,

§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> Unpin for Lcd<'a, 'b, Sender, Delayer, READABLE>

§

impl<'a, 'b, Sender, Delayer, const READABLE: bool> !UnwindSafe for Lcd<'a, 'b, Sender, Delayer, READABLE>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.