Commit 10df9647 authored by Astro's avatar Astro
Browse files

l0dable: add update_rgb_leds()

parent a0d9692d
use card10_sys::*;
#[derive(Clone, Copy)]
pub enum LEDColor {
RGB(u8, u8, u8),
HSV(f32, f32, f32),
}
pub fn update_rgb_leds<F>(f: F)
where
F: Fn(i32) -> LEDColor,
{
for index in 0..=10 {
let color = f(index);
match color {
LEDColor::RGB(r, g, b) => unsafe {
epic_leds_prep(index, r, g, b);
}
LEDColor::HSV(h, s, v) => unsafe {
epic_leds_prep_hsv(index, h, s, v);
}
}
unsafe {
epic_leds_update();
}
}
}
......@@ -25,6 +25,8 @@ pub use bhi160::{
SensorData as BHI160Data,
};
pub mod fs;
mod leds;
pub use leds::*;
/// Type check the user-supplied entry function.
#[macro_export]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment