1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use stm32f4xx_hal::gpio::gpioc::PC0;
use stm32f4xx_hal::gpio::{Output, PushPull, Speed};
use ws2812_timer_delay::Ws2812;
use embedded_hal::timer::{CountDown, Periodic};
pub struct NeoPixel<Timer> {
pub ws: Ws2812<Timer, PC0<Output<PushPull>>>,
}
impl<Timer: CountDown + Periodic> NeoPixel<Timer> {
pub fn new<M>(pin: PC0<M>, timer: Timer) -> Self {
let pin = pin.into_push_pull_output().set_speed(Speed::High);
let ws = Ws2812::new(timer, pin);
NeoPixel { ws }
}
}