Struct BaseCharacterDisplay

Source
pub struct BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where I2C: I2c, DELAY: DelayNs, DEVICE: DeviceHardwareTrait<I2C, DELAY>, ACTIONS: DisplayActionsTrait<I2C, DELAY, DEVICE>,
{ /* private fields */ }

Implementations§

Source§

impl<I2C, DELAY, DEVICE, ACTIONS> BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where I2C: I2c, DELAY: DelayNs, DEVICE: DeviceHardwareTrait<I2C, DELAY>, ACTIONS: DisplayActionsTrait<I2C, DELAY, DEVICE>,

Source

pub fn new(i2c: I2C, lcd_type: LcdDisplayType, delay: DELAY) -> Self

Create a new character display object with the default I2C address for the adapter.

Source

pub fn new_with_address( i2c: I2C, address: u8, lcd_type: LcdDisplayType, delay: DELAY, ) -> Self

Create a new character display object with a specific I2C address for the adapter.

Source

pub fn init(&mut self) -> Result<(), CharacterDisplayError<I2C>>

Initialize the display. This must be called before using the display.

Source

pub fn display_type(&self) -> LcdDisplayType

returns the LcdDisplayType used to create the display

Source

pub fn supports_reads() -> bool

Supports the ability to read from the display.

Source

pub fn read_device_data( &mut self, buffer: &mut [u8], ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Reads into the buffer data from the display device either the CGRAM or DDRAM at the current cursor position. For multiple devices, this reads from the currently active device as set by the cursor position. The amount of data read is determined by the length of the buffer. Not all adapters support reads from the device. This will return an error if the adapter does not support reads.

Source

pub fn read_address_counter(&mut self) -> Result<u8, CharacterDisplayError<I2C>>

Reads the address counter from the display device. The ready bit is masked off. Not all adapters support reads from the device. This will return an error if the adapter does not support reads.

Source

pub fn clear(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>

Clear the display

Source

pub fn home(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the cursor to the home position.

Source

pub fn set_cursor( &mut self, col: u8, row: u8, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the cursor position at specified column and row. Columns and rows are zero-indexed.

Source

pub fn show_cursor( &mut self, show_cursor: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the cursor visibility.

Set the cursor blinking.

Source

pub fn show_display( &mut self, show_display: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the display visibility.

Source

pub fn scroll_display_left( &mut self, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Scroll the display to the left.

Source

pub fn scroll_display_right( &mut self, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Scroll the display to the right.

Source

pub fn left_to_right(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the text flow direction to left to right.

Source

pub fn right_to_left(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the text flow direction to right to left.

Source

pub fn autoscroll( &mut self, autoscroll: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the auto scroll mode.

Source

pub fn create_char( &mut self, location: u8, charmap: [u8; 8], ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Create a new custom character.

Source

pub fn print( &mut self, text: &str, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Prints a string to the LCD at the current cursor position of the active device.

Source

pub fn backlight( &mut self, on: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Turn the backlight on or off. Note that the AIP31068 controller does not support backlight control.

Source

pub fn set_contrast( &mut self, contrast: u8, ) -> Result<&mut Self, CharacterDisplayError<I2C>>

Set the contrast level of the display. This is only supported by the ST7032i controller.

Trait Implementations§

Source§

impl<I2C, DELAY, DEVICE, ACTIONS> Write for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where I2C: I2c, DELAY: DelayNs, DEVICE: DeviceHardwareTrait<I2C, DELAY>, ACTIONS: DisplayActionsTrait<I2C, DELAY, DEVICE>,

Implement the core::fmt::Write trait, allowing it to be used with the write! macro. This is a convenience method for printing to the display. For multi-device, this will print to the active device as set by set_cursor.

Source§

fn write_str(&mut self, s: &str) -> Result<(), Error>

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl<I2C, DELAY, DEVICE, ACTIONS> Freeze for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where DEVICE: Freeze, ACTIONS: Freeze,

§

impl<I2C, DELAY, DEVICE, ACTIONS> RefUnwindSafe for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where DEVICE: RefUnwindSafe, ACTIONS: RefUnwindSafe, I2C: RefUnwindSafe, DELAY: RefUnwindSafe,

§

impl<I2C, DELAY, DEVICE, ACTIONS> Send for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where DEVICE: Send, ACTIONS: Send, I2C: Send, DELAY: Send,

§

impl<I2C, DELAY, DEVICE, ACTIONS> Sync for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where DEVICE: Sync, ACTIONS: Sync, I2C: Sync, DELAY: Sync,

§

impl<I2C, DELAY, DEVICE, ACTIONS> Unpin for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where DEVICE: Unpin, ACTIONS: Unpin, I2C: Unpin, DELAY: Unpin,

§

impl<I2C, DELAY, DEVICE, ACTIONS> UnwindSafe for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
where DEVICE: UnwindSafe, ACTIONS: UnwindSafe, I2C: UnwindSafe, DELAY: 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.