[][src]Struct hd44780_driver::HD44780

pub struct HD44780<B: DataBus> { /* fields omitted */ }

Implementations

impl<RS: OutputPin, EN: OutputPin, D0: OutputPin, D1: OutputPin, D2: OutputPin, D3: OutputPin, D4: OutputPin, D5: OutputPin, D6: OutputPin, D7: OutputPin> HD44780<EightBitBus<RS, EN, D0, D1, D2, D3, D4, D5, D6, D7>>[src]

pub fn new_8bit<D: DelayUs<u16> + DelayMs<u8>>(
    rs: RS,
    en: EN,
    d0: D0,
    d1: D1,
    d2: D2,
    d3: D3,
    d4: D4,
    d5: D5,
    d6: D6,
    d7: D7,
    delay: &mut D
) -> Result<HD44780<EightBitBus<RS, EN, D0, D1, D2, D3, D4, D5, D6, D7>>>
[src]

Create an instance of a HD44780 from 8 data pins, a register select pin, an enable pin and a struct implementing the delay trait.

  • The delay instance is used to sleep between commands to ensure the HD44780 has enough time to process commands.
  • The eight db0..db7 pins are used to send and recieve with the HD44780.
  • The register select pin is used to tell the HD44780 if incoming data is a command or data.
  • The enable pin is used to tell the HD44780 that there is data on the 8 data pins and that it should read them in.

impl<RS: OutputPin, EN: OutputPin, D4: OutputPin, D5: OutputPin, D6: OutputPin, D7: OutputPin> HD44780<FourBitBus<RS, EN, D4, D5, D6, D7>>[src]

pub fn new_4bit<D: DelayUs<u16> + DelayMs<u8>>(
    rs: RS,
    en: EN,
    d4: D4,
    d5: D5,
    d6: D6,
    d7: D7,
    delay: &mut D
) -> Result<HD44780<FourBitBus<RS, EN, D4, D5, D6, D7>>>
[src]

Create an instance of a HD44780 from 4 data pins, a register select pin, an enable pin and a struct implementing the delay trait.

  • The delay instance is used to sleep between commands to ensure the HD44780 has enough time to process commands.
  • The four db0..db3 pins are used to send and recieve with the HD44780.
  • The register select pin is used to tell the HD44780 if incoming data is a command or data.
  • The enable pin is used to tell the HD44780 that there is data on the 4 data pins and that it should read them in.

This mode operates differently than 8 bit mode by using 4 less pins for data, which is nice on devices with less I/O although the I/O takes a 'bit' longer

Instead of commands being sent byte by byte each command is broken up into it's upper and lower nibbles (4 bits) before being sent over the data bus

impl<I2C: Write> HD44780<I2CBus<I2C>>[src]

pub fn new_i2c<D: DelayUs<u16> + DelayMs<u8>>(
    i2c_bus: I2C,
    address: u8,
    delay: &mut D
) -> Result<HD44780<I2CBus<I2C>>>
[src]

Create an instance of a HD44780 from an i2c write peripheral, the HD44780 I2C address and a struct implementing the delay trait.

  • The delay instance is used to sleep between commands to ensure the HD44780 has enough time to process commands.
  • The i2c peripheral is used to send data to the HD44780 and to set its register select and enable pins.

This mode operates on an I2C bus, using an I2C to parallel port expander

impl<B> HD44780<B> where
    B: DataBus
[src]

pub fn reset<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    delay: &mut D
) -> Result<()>
[src]

Unshifts the display and sets the cursor position to 0

This example is not tested
lcd.reset();

pub fn set_display_mode<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    display_mode: DisplayMode,
    delay: &mut D
) -> Result<()>
[src]

Set if the display should be on, if the cursor should be visible, and if the cursor should blink

Note: This is equivilent to calling all of the other relavent methods however this operation does it all in one go to the HD44780

pub fn clear<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    delay: &mut D
) -> Result<()>
[src]

Clear the entire display

This example is not tested
lcd.clear();

pub fn set_autoscroll<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    enabled: bool,
    delay: &mut D
) -> Result<()>
[src]

If enabled, automatically scroll the display when a new character is written to the display

This example is not tested
lcd.set_autoscroll(true);

pub fn set_cursor_visibility<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    visibility: Cursor,
    delay: &mut D
) -> Result<()>
[src]

Set if the cursor should be visible

pub fn set_display<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    display: Display,
    delay: &mut D
) -> Result<()>
[src]

Set if the characters on the display should be visible

Set if the cursor should blink

pub fn set_cursor_mode<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    mode: CursorMode,
    delay: &mut D
) -> Result<()>
[src]

Set which way the cursor will move when a new character is written

This example is not tested
// Move right (Default) when a new character is written
lcd.set_cursor_mode(CursorMode::Right)

// Move left when a new character is written
lcd.set_cursor_mode(CursorMode::Left)

pub fn set_cursor_pos<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    position: u8,
    delay: &mut D
) -> Result<()>
[src]

Set the cursor position

This example is not tested
// Move to line 2
lcd.set_cursor_pos(40)

pub fn shift_cursor<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    dir: Direction,
    delay: &mut D
) -> Result<()>
[src]

Shift just the cursor to the left or the right

This example is not tested
lcd.shift_cursor(Direction::Left);
lcd.shift_cursor(Direction::Right);

pub fn shift_display<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    dir: Direction,
    delay: &mut D
) -> Result<()>
[src]

Shift the entire display to the left or the right

This example is not tested
lcd.shift_display(Direction::Left);
lcd.shift_display(Direction::Right);

pub fn write_char<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    data: char,
    delay: &mut D
) -> Result<()>
[src]

Write a single character to the HD44780. This char just gets downcast to a u8 internally, so make sure that whatever character you're printing fits inside that range, or you can just use write_byte to have the compiler check for you. See the documentation on that function for more details about compatibility.

This example is not tested
lcd.write_char('A', &mut delay)?; // prints 'A'

pub fn write_str<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    string: &str,
    delay: &mut D
) -> Result<()>
[src]

Writes a string to the HD44780. Internally, this just prints the string byte-by-byte, so make sure the characters in the string fit in a normal u8. See the documentation on write_byte for more details on compatibility.

This example is not tested
lcd.write_str("Hello, World!", &mut delay)?;

pub fn write_bytes<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    string: &[u8],
    delay: &mut D
) -> Result<()>
[src]

Writes a sequence of bytes to the HD44780. See the documentation on the write_byte function for more details about compatibility.

This example is not tested
lcd.write_bytes(b"Hello, World!", &mut delay)?;

pub fn write_byte<D: DelayUs<u16> + DelayMs<u8>>(
    &mut self,
    data: u8,
    delay: &mut D
) -> Result<()>
[src]

Writes a single byte to the HD44780. These usually map to ASCII characters when printed on the screen, but not always. While it varies depending on the ROM of the LCD, 0x20u8..=0x5b and 0x5d..=0x7d should map to their standard ASCII characters. That is, all the printable ASCII characters work, excluding \ and ~, which are usually displayed as ¥ and 🡢 respectively.

More information can be found in the Hitachi datasheets for the HD44780.

This example is not tested
lcd.write_byte(b'A', &mut delay)?; // prints 'A'
lcd.write_byte(b'\\', &mut delay)?; // usually prints ¥
lcd.write_byte(b'~', &mut delay)?; // usually prints 🡢
lcd.write_byte(b'\x7f', &mut delay)?; // usually prints 🡠

Auto Trait Implementations

impl<B> Send for HD44780<B> where
    B: Send

impl<B> Sync for HD44780<B> where
    B: Sync

impl<B> Unpin for HD44780<B> where
    B: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.