Driver for the LCD1602RGB segmented LCD, it is not intended for use with other segmented LCDs, however you may be able to use this driver for some basic functionality.
I wrote this driver for my own personal use and will maintain it and implement missing instructions when I need them, especially concerning an application I plan to work on. However feel free to submit a pull request.
This my first real embedded Rust project, and I used the following resources:
- PCA9633 Datasheet
- AiP21068 Datasheet
- Embedded HAL Docs
- Raspberry Pi Pico Pinout Datasheet
- LCD1602-RGB Datasheet
- LCD1602 i2c driver by JohnSL
- Pi Pico Project Template
Follow the instructions here: https://github.com/rp-rs/rp2040-project-template
Include latest version in Cargo.toml
:
[dependencies]
lcd1602rgb-rs = "0.2.0"
Use this example code in the main.rs
of the rp2040 project template.
let mut scl_pin = pins.gpio15.into_mode::<gpio::FunctionI2C>();
let mut sda_pin = pins.gpio14.into_mode::<gpio::FunctionI2C>();
let i2c_dev = i2c::I2C::new_controller(pac.I2C1, sda_pin, scl_pin, 400_u32.kHz(), &mut pac.RESETS, clocks.system_clock.freq());
let mut display_controller = Display::new(i2c_dev, delay).unwrap();
display_controller.write_text("Hello, World! How are you?").unwrap();
let mut r: u8 = 0;
let mut g: u8 = 255;
let mut b: u8 = 128;
let mut r_set = true;
let mut g_set = true;
let mut b_set = true;
loop {
if r == 255 {
r_set = false;
} else if r == 0 {
r_set = true;
}
if r_set {
r += 1;
} else {
r -= 1;
}
if g == 255 {
g_set = false;
} else if g == 0 {
g_set = true;
}
if g_set {
g += 1;
} else {
g -= 1;
}
if b == 255 {
b_set = false;
} else if b == 0 {
b_set = true;
}
if b_set {
b += 1;
} else {
b -= 1;
}
display_controller.delay.delay_ms(10);
display_controller.backlight_colour(r, g, b).unwrap();
}
- Remove platform-specific dependencies. 238d4c0
- Implement on/off according to specification sheet.
- Implement remaining missing instructions.
- Verify behaviour of AiP31068 when writing more than 16 characters to one line.
- Adjust functionality accordingly.
- Cleanup of code.
- Improve consistency.
- Organise.
- Find alternative to emotes for checkboxes in
README.md
. - Create instructions for usage with other platforms.
- Improve Raspberry Pi Pico usage instructions.