3 releases (breaking)

0.3.0 Jan 13, 2025
0.2.0 Feb 4, 2024
0.1.0 Jun 7, 2023

#234 in Hardware support

Download history 1/week @ 2024-09-29 6/week @ 2024-12-01 28/week @ 2024-12-08 14/week @ 2024-12-15 1/week @ 2024-12-29 3/week @ 2025-01-05 102/week @ 2025-01-12

107 downloads per month

MIT/Apache

88KB
2K SLoC

LCD1602 Driver

crates.io docs.rs

An embedded-hal based driver for the LCD1602 display

INFO

The most common functions have been implemented, but this crate is still in a very early stage of development, so the API and functionality may change.

Features

  • Support both parallel interface, and I2C adapter board interface
  • Support Write-Only control mode
  • Covers every(?) instruction of the LCD1602
    • 4 Pin / 8 Pin mode
    • 1 line / 2 line display
    • left to right / right to left writing
    • Offset display window
    • Read busy flag
    • Read/write DDRAM and CGRAM
    • Set cursor show/hide, set cursor blink or not
    • And other functions directly provided by the LCD1602 instructions
  • All instructions are sent after reading the busy flag for the efficient execution
    • Note: According to the LCD1602 specification, the first few instructions of the initialization process must wait for a specific amount of time
  • Simulates the state of the LCD1602 in the MCU's memory to reduce unnecessary reads from the LCD1602 memory
  • Some commonly used functionalities
    • Initialize LCD via Builder pattern
    • Write strings at the current position
    • Write strings at a specific position represented by (x,y) coordinates
    • Offset cursor position relatively (represented by (x,y) coordinates)
    • Offset display window to a specific position
    • Write custom character graph represented by an array to a specific position in CGRAM
    • Read custom characters at a specific position in CGRAM
    • Toggle the display of the entire display on/off
  • Some simple animation effects
    • Delay execution (microseconds/milliseconds)
    • Full-screen blinking (endless/specific number of times)
    • Typewriter-style string display
    • Split-flap-style string display (one by one/simultaneously)
  • And more...

Minimum Supported Rust Version (MSRV)

1.81

Examples

See examples/demo_with_stm32f411

CHANGELOG

v0.3.0

  • Add Write-Only control mode. @ImTheSquid
  • Support custom 5x11 Font graph
  • Rename write_u8_to_cur() to write_byte_to_cur()
  • Add sufficient delay after ClearDisplay and ReturnHome command
  • Properly handle cross check between LineMode and Font
  • Automatically update LineMode and Font in Config when either of them changed
  • Other bugs fix

v0.2.0

  • Upgrade to embedded-hal 1.0
  • Add I2C adapter board support
  • Simplify codebase

v0.1.0

  • First Release

Dependencies

~56KB