Display

Struct Display 

Source
pub struct Display<P, U>
where U: Into<Address> + Home,
{ /* private fields */ }
Expand description

A HD44780 compliant display.

It provides a high-level and hardware agnostic interface to controll a HD44780 compliant liquid crystal display (LCD).

Implementations§

Source§

impl<P, U> Display<P, U>
where P: Init + Send + Receive, U: Into<Address> + Home,

Source

pub fn new(connection: P) -> Self

Create a new Display using the given connection.

Source

pub fn init(&self, builder: &FunctionSetBuilder)

Source

pub fn set_entry_mode(&self, builder: &EntryModeBuilder)

Sets the entry mode of the display.

Source

pub fn set_display_control(&self, builder: &DisplayControlBuilder)

Sets the display control settings.

Source

pub fn shift_cursor(&mut self, direction: ShiftTo)

Shifts the cursor to the left or the right by the given offset.

Note: Consider to use seek() for longer distances.

Source

pub fn shift(&self, direction: ShiftTo)

Shifts the display to the right or the left by the given offset.

Note that the first and second line will shift at the same time.

When the displayed data is shifted repeatedly each line moves only horizontally. The second line display does not shift into the first line position.

Source

pub fn clear(&self)

Clears the entire display, sets the cursor to the home position and undo all display shifts.

It also sets the cursor’s move direction to Increment.

Source

pub fn seek(&mut self, pos: SeekFrom<U>)

Seeks to an offset in display data RAM.

Source

pub fn seek_cgram(&mut self, pos: SeekFrom<U>)

Seeks to an offset in display character generator RAM.

Source

pub fn write(&mut self, c: u8)

Writes the given byte to data or character generator RAM, depending on the previous seek operation.

Source

pub fn read_byte(&mut self) -> u8

Reads a single byte from data RAM.

Source

pub fn read_busy_flag(&self) -> (bool, u8)

Reads busy flag and the cursor’s current address.

Source

pub fn write_message(&mut self, msg: &str)

Writes the given message to data or character generator RAM, depending on the previous seek operation.

Source

pub fn get_connection(self) -> P

Auto Trait Implementations§

§

impl<P, U> Freeze for Display<P, U>
where P: Freeze,

§

impl<P, U> RefUnwindSafe for Display<P, U>

§

impl<P, U> Send for Display<P, U>
where P: Send, U: Send,

§

impl<P, U> Sync for Display<P, U>
where P: Sync, U: Sync,

§

impl<P, U> Unpin for Display<P, U>
where P: Unpin, U: Unpin,

§

impl<P, U> UnwindSafe for Display<P, U>
where P: UnwindSafe, U: UnwindSafe,

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.