1 unstable release
new 0.1.0 | Dec 16, 2024 |
---|
#883 in Network programming
12KB
188 lines
colorlight_rs
A Rust library for detecting and sending frames to Colorlight 5A-75 LED receiver cards via Ethernet.
Features
- Detect receiver card
- Send display frames (brightness, color temperature)
- Send row-based pixel data frames (BGR pixel data)
Requirements
- Rust (stable or later)
- Elevated privileges (CAP_NET_RAW or equivalent)
- Network interface connected to the Colorlight 5A-75 card
Installation
Add to Cargo.toml
:
[dependencies]
colorlight_rs = { git = "https://github.com/your-repo/colorlight_rs.git", branch = "main" }
Example Usage
use colorlight_rs::ColorlightCard;
fn main() -> std::io::Result<()> {
let interface_name = "eth0";
let mut controller = ColorlightCard::open(interface_name)?;
let info = controller.detect_receiver()?;
println!("Receiver Info: {:?}", info);
controller.send_display_frame(0xFF, 0xFF, 0x76, 0x06)?;
let row_data_bgr: Vec<u8> = vec![0u8; 256 * 3];
controller.send_row(0, &row_data_bgr)?;
Ok(())
}
Acknowledgements
Many thanks to hkubota for his detailed blog post on the Colorlight 5A-75B protocol.
License
Dependencies
~2.9–4.5MB
~79K SLoC