#driver #raspberry #cursor #hd44780

pwr-hd44780

A driver for the HD44780 LCD. Has support for both I2C and GPIO buses + implements a high-speed buffered version.

8 releases

Uses old Rust 2015

0.1.3 Apr 2, 2018
0.1.2 Feb 9, 2018
0.0.5 Feb 8, 2018
0.0.2 Jan 29, 2018

#1300 in Hardware support

Download history 1/week @ 2023-06-07 10/week @ 2023-06-14 32/week @ 2023-06-21 29/week @ 2023-06-28 10/week @ 2023-07-05 9/week @ 2023-07-12 13/week @ 2023-07-19 15/week @ 2023-07-26 7/week @ 2023-08-02 10/week @ 2023-08-09 21/week @ 2023-08-16 15/week @ 2023-08-23 6/week @ 2023-08-30 22/week @ 2023-09-06 20/week @ 2023-09-13 7/week @ 2023-09-20

67 downloads per month

MIT license

27KB
502 lines

pwr-hd44780

Version

Documentation

A Rust crate allowing to communicate with the HD44780 LCDs.

What buses are supported?

  • 4-bit GPIO bus (thanks to the rppal library),
  • I2C bus (thanks to the rust-i2cdev library).

Would you mind showing me some code?

Sure, pal:

extern crate pwr_hd44780;

use pwr_hd44780::Hd44780;

fn main() {
    run().unwrap();
}

fn run() -> Result<(), Box<std::error::Error>> {
    // create the LCD's bus instance;
    // use device at address 0x27 on the first I2C bus
    let lcd_bus = pwr_hd44780::I2CBus::new(
        "/dev/i2c-1", 0x27,
    )?;

    // create the direct LCD's instance;
    // use bus created before and assume LCD's width x height = 20 x 4
    let mut lcd = pwr_hd44780::DirectLcd::new(
        Box::new(lcd_bus),
        20, 4,
    )?;

    // finally - print our text
    lcd.clear()?;
    lcd.print("Hello World! :-)")?;

    Ok(())
}

For more examples, take a dive into the examples directory.

License

Copyright (c) 2018, Patryk Wychowaniec <wychowaniec.patryk@gmail.com>.
Licensed under the MIT license.

Dependencies

~2.5–4MB
~67K SLoC