| Crates.io | bd18378 |
| lib.rs | bd18378 |
| version | 0.1.0 |
| created_at | 2025-05-27 08:19:14.315333+00 |
| updated_at | 2025-05-27 08:19:14.315333+00 |
| description | Platform-Agnostic Driver for ROHM BD18378 12CH LED Driver IC |
| homepage | |
| repository | https://github.com/Uekue/bd18378-rs/ |
| max_upload_size | |
| id | 1690763 |
| size | 54,647 |
Driver for ROHM BD18378 12CH LED Driver IC
A Rust driver for the ROHM BD18378 12CH LED Driver IC, suitable for embedded applications.
This crate supports embedded-hal traits and is fully compatible with #![no_std] environments.
embedded-hal::spi traits#![no_std] environmentsAdd the following to your Cargo.toml:
[dependencies]
bd18378 = "0.1"
or add it via command line using:
cargo add bd18378
#![no_std]
use bd18378::Bd18378;
use embedded_hal::spi::SpiDevice;
use embedded_hal_bus::spi::{ExclusiveDevice, NoDelay};
fn main() {
// Initialize the SPI interface
let spi = ...; // Your SPI implementation here
let cs = ...; // Chip select pin
let mut spi_dev = ExclusiveDevice::new_no_delay(&mut spi, &mut cs).unwrap();
// Create a new instance of the BD18378 driver
let mut led_driver = Bd18378::new(&mut spi_dev);
// Initialize the driver
led_driver.init().ok();
// Set the brightness of channel 0 to maximum
led_driver.set_channel_calibration(0, 0x3Fu8).ok();
// Turn on channel 0
led_driver.enable_channel(0).ok();
led_driver.update_all_channels().ok();
}
Auto-generated API documentation is available at: https://docs.rs/bd18378
This driver is (not yet) suitable for safety-critical applications. In case you need to use it in such an environment, please contact me and I can make the necessary adaptions.
This project is dual-licensed under either:
You may choose the license that best fits your project.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.