#embedded-hal #hd44780 #lcd #embedded-hal-driver #no-std

no-std hd44780-driver

一个用于使用嵌入式-hal库的HD44780兼容显示屏的crate

4个版本 (2个重大更新)

0.4.0 2020年9月15日
0.3.0 2019年2月21日
0.2.1 2018年10月17日
0.2.0 2018年8月8日

#239嵌入式开发

Download history 291/week @ 2024-03-13 207/week @ 2024-03-20 178/week @ 2024-03-27 279/week @ 2024-04-03 195/week @ 2024-04-10 219/week @ 2024-04-17 245/week @ 2024-04-24 169/week @ 2024-05-01 164/week @ 2024-05-08 123/week @ 2024-05-15 347/week @ 2024-05-22 302/week @ 2024-05-29 224/week @ 2024-06-05 221/week @ 2024-06-12 144/week @ 2024-06-19 323/week @ 2024-06-26

931 每月下载量
6 个crate中使用 (5个直接使用)

MIT 许可证

2MB
776

hd44780-driver

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

HD44780的embedded-hal特质的实现。

示例

可以在这里找到多个不同板子的示例 这里

支持实现embedded-hal特质的任何平台!有关支持平台列表,请参阅awesome-embedded-rust

入门

这个库的目标是保持简单,要开始使用,您只需要提供一个函数,将您的平台中实现embedded-halOutputPin特质的多个引脚和一个实现DelayUs<u16>DelayMs<u8>延迟特质的结构体给HD44780::new函数。

// 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);

特性

  • 支持4位和8位模式
  • 支持i2c背包

待办事项

  • 忙标志支持(等待embedded-hal对引脚进行读写支持)
  • 非阻塞API
  • 更用户友好的API,并增加了更多特性
  • 自定义字符

贡献

  • 欢迎提出更多问题和pull请求。

  • 如果您有一个尚未在本仓库中涵盖但由embedded-hal支持的平台,提出一个示例的pull请求将会很棒!

许可证

本项目采用MIT许可协议(LICENSEhttps://opensource.org/licenses/MIT

依赖项