3 unstable releases
0.3.0 | Aug 7, 2021 |
---|---|
0.2.1 | Aug 2, 2021 |
0.2.0 | Aug 2, 2021 |
#1688 in Embedded development
42 downloads per month
330KB
179 lines
I2C Character LCD Driver
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.
Speed
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.
Example
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();
License
This project is licensed under MIT license (LICENSE or https://opensource.org/licenses/MIT)