#hd44780 #embedded-hal #lcd #embedded-hal-driver

no-std hd44780-driver

A crate to use HD44780 compliant displays with embedded-hal

4 releases (2 breaking)

0.4.0 Sep 15, 2020
0.3.0 Feb 21, 2019
0.2.1 Oct 17, 2018
0.2.0 Aug 8, 2018

#311 in Embedded development

Download history 565/week @ 2024-08-02 258/week @ 2024-08-09 692/week @ 2024-08-16 512/week @ 2024-08-23 280/week @ 2024-08-30 316/week @ 2024-09-06 236/week @ 2024-09-13 186/week @ 2024-09-20 319/week @ 2024-09-27 178/week @ 2024-10-04 310/week @ 2024-10-11 279/week @ 2024-10-18 221/week @ 2024-10-25 207/week @ 2024-11-01 251/week @ 2024-11-08 159/week @ 2024-11-15

859 downloads per month
Used in 7 crates (6 directly)

MIT license

2MB
776 lines

hd44780-driver

crates.io crates.io travis-ci.org API

Implementation of the embedded-hal traits for the HD44780.

Examples

Examples for several different boards can be found here

Any platform that implements the embedded-hal traits is supported by this library! See awesome-embedded-rust for a list of supported platforms.

Getting Started

This library aims to keep it simple in that to get started all you will have to do is supply the HD44780::new function a bunch of pins from your platform that implement the OutputPin trait for embedded-hal as well as a struct that implements the delay traits DelayUs<u16> and DelayMs<u8>.

// Pseudo-code: check the HAL crate for your specific device for exact code to get pins / delay
// It is recommended to use push/pull output pins, but if your specific LCD device has pull-up resistors
// an open/drain output pin should work too

let mut delay = Delay::new();

let mut lcd = HD44780::new_4bit(
    d4.into_push_pull_output(&mut port), // Register Select pin
    d3.into_push_pull_output(&mut port), // Enable pin

    d9.into_push_pull_output(&mut port),  // d4
    d10.into_push_pull_output(&mut port), // d5
    d11.into_push_pull_output(&mut port), // d6
    d12.into_push_pull_output(&mut port), // d7
    &mut delay,
);

// Unshift display and set cursor to 0
lcd.reset(&mut delay); 

// Clear existing characters
lcd.clear(&mut delay); 

// Display the following string
lcd.write_str("Hello, world!", &mut delay);

// Move the cursor to the second line
lcd.set_cursor_pos(40, &mut delay);

// Display the following string on the second line
lcd.write_str("I'm on line 2!", &mut delay);

Features

  • 4-bit & 8-bit modes are supported
  • Support for i2c backpacks

Todo

  • Busy flag support (Waiting for support from embedded-hal to read and write from a pin)
  • Non-blocking API
  • A more user-friendly API with additional features
  • Custom characters

Contributing

  • Additional issues as well as pull-requests are welcome.

  • If you have a platform not yet covered in this repository that is supported by embedded-hal, a pull-request of an example would be awesome!

License

This project is licensed under MIT license (LICENSE or https://opensource.org/licenses/MIT)

Dependencies