Crates.io | lp5018 |
lib.rs | lp5018 |
version | 0.1.4 |
source | src |
created_at | 2021-06-16 13:36:36.390273 |
updated_at | 2022-03-10 11:26:25.614111 |
description | no_std driver for the lp5018 i2c LED driver |
homepage | |
repository | https://github.com/robhany/lp5018 |
max_upload_size | |
id | 410875 |
size | 22,264 |
This crate is a no_std driver for the lp5018 i2c LED driver.
https://www.ti.com/lit/gpn/lp5018
This driver does not support all features of the LED driver such as power saving mode, programmable bank support or auto-increment for writing or reading with one transition. It supports setting the brightness of each output.
Add this to your Cargo.toml:
[dependencies]
lp5018 = "0.1.4"
And this to your main.rs
let mut led_controller_enable_pin = some_pin;
let mut led_controller = lp5018::LedDriver::new();
led_controller.set_address(true, true);
led_controller_enable_pin.set_high().unwrap();
timer.delay_ms(500_u32);
led_controller.reset(&mut i2c).unwrap();
led_controller.init_device(&mut i2c).unwrap();
loop {
//turn on LED
led_controller
.change_intensity_for_output(&mut i2c, Out00, 0xff)
.unwrap();
timer.delay_ms(500_u32);
//turn off LED
led_controller
.change_intensity_for_output(&mut i2c, Out00, 0x00)
.unwrap();
timer.delay_ms(500_u32);
}
Licensed under either of
at your option.