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>
impl<I2C, DELAY, DEVICE, ACTIONS> BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
Sourcepub fn new(i2c: I2C, lcd_type: LcdDisplayType, delay: DELAY) -> Self
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.
Sourcepub fn new_with_address(
i2c: I2C,
address: u8,
lcd_type: LcdDisplayType,
delay: DELAY,
) -> Self
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.
Sourcepub fn init(&mut self) -> Result<(), CharacterDisplayError<I2C>>
pub fn init(&mut self) -> Result<(), CharacterDisplayError<I2C>>
Initialize the display. This must be called before using the display.
Sourcepub fn display_type(&self) -> LcdDisplayType
pub fn display_type(&self) -> LcdDisplayType
returns the LcdDisplayType
used to create the display
Sourcepub fn supports_reads() -> bool
pub fn supports_reads() -> bool
Supports the ability to read from the display.
Sourcepub fn read_device_data(
&mut self,
buffer: &mut [u8],
) -> Result<&mut Self, CharacterDisplayError<I2C>>
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.
Sourcepub fn read_address_counter(&mut self) -> Result<u8, CharacterDisplayError<I2C>>
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.
Sourcepub fn clear(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn clear(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
Clear the display
Sourcepub fn home(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn home(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the cursor to the home position.
Sourcepub fn set_cursor(
&mut self,
col: u8,
row: u8,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
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.
Sourcepub fn show_cursor(
&mut self,
show_cursor: bool,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn show_cursor( &mut self, show_cursor: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the cursor visibility.
Sourcepub fn blink_cursor(
&mut self,
blink_cursor: bool,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn blink_cursor( &mut self, blink_cursor: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the cursor blinking.
Sourcepub fn show_display(
&mut self,
show_display: bool,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn show_display( &mut self, show_display: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the display visibility.
Sourcepub fn scroll_display_left(
&mut self,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn scroll_display_left( &mut self, ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Scroll the display to the left.
Sourcepub fn scroll_display_right(
&mut self,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn scroll_display_right( &mut self, ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Scroll the display to the right.
Sourcepub fn left_to_right(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn left_to_right(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the text flow direction to left to right.
Sourcepub fn right_to_left(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn right_to_left(&mut self) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the text flow direction to right to left.
Sourcepub fn autoscroll(
&mut self,
autoscroll: bool,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn autoscroll( &mut self, autoscroll: bool, ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Set the auto scroll mode.
Sourcepub fn create_char(
&mut self,
location: u8,
charmap: [u8; 8],
) -> Result<&mut Self, CharacterDisplayError<I2C>>
pub fn create_char( &mut self, location: u8, charmap: [u8; 8], ) -> Result<&mut Self, CharacterDisplayError<I2C>>
Create a new custom character.
Sourcepub fn print(
&mut self,
text: &str,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
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.
Sourcepub fn backlight(
&mut self,
on: bool,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
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.
Sourcepub fn set_contrast(
&mut self,
contrast: u8,
) -> Result<&mut Self, CharacterDisplayError<I2C>>
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>
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
.
impl<I2C, DELAY, DEVICE, ACTIONS> Write for BaseCharacterDisplay<I2C, DELAY, DEVICE, ACTIONS>
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
.