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 在 嵌入式开发
931 每月下载量
在 6 个crate中使用 (5个直接使用)
2MB
776 行
hd44780-driver
HD44780的embedded-hal
特质的实现。
示例
可以在这里找到多个不同板子的示例 这里
支持实现embedded-hal特质的任何平台!有关支持平台列表,请参阅awesome-embedded-rust。
入门
这个库的目标是保持简单,要开始使用,您只需要提供一个函数,将您的平台中实现embedded-hal的OutputPin
特质的多个引脚和一个实现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许可协议(LICENSE 或 https://opensource.org/licenses/MIT)