Crates.io | lcd_1602_i2c |
lib.rs | lcd_1602_i2c |
version | 0.3.0 |
source | src |
created_at | 2021-08-02 00:29:41.617704 |
updated_at | 2021-08-07 18:40:39.458551 |
description | A crate to use I2C character LCD displays that use the AiP31068L chip with embedded-hal |
homepage | |
repository | https://github.com/JohnSL/lcd_1602_i2c |
max_upload_size | |
id | 430185 |
size | 349,253 |
Provides an embedded Rust driver for common 16x2 LCD displays that use the AiP31068L chip to drive the display, and a PCA9633 chip to drive the RGB backlight.
This has been tested with the Waveshare LCD1602 module. It may also work with other RGB displays like the Groove 16X2 LDC RGB, but I haven't tested it.
This is a basic implementation, and doesn't currently support custom characters.
This driver is fast enough that there are no noticable delays when updating text on the screen. In my programs, I'm using spaces to clear the ends of lines rather than clearing the screen.
Currently there is a single, but working, example of using this crate in the examples/STM32F10x folder. The example is using an STM32F103RB Nucleo-64 board. This is a nice little board as it has the programmer/debugger built into the board.
let scl = gpiob.pb10.into_alternate_open_drain(&mut gpiob.crh);
let sda = gpiob.pb11.into_alternate_open_drain(&mut gpiob.crh);
let i2c_bus = BlockingI2c::i2c2(
peripherals.I2C2,
(scl, sda),
i2c::Mode::Standard {
frequency: 400_000.hz(),
},
clocks,
&mut rcc.apb1,
1000,
10,
1000,
1000,
);
let mut lcd = Lcd::new(i2c_bus, LCD_ADDRESS, RGB_ADDRESS, &mut delay).unwrap();
lcd.set_rgb(255, 255, 255).unwrap();
lcd.print("Hello world!").unwrap();
This project is licensed under MIT license (LICENSE or https://opensource.org/licenses/MIT)