diff --git a/Cargo.toml b/Cargo.toml index 4da9057..1dd149c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,9 @@ documentation = "https://docs.rs/ws2812-pio" repository = "https://github.com/rp-rs/ws2812-pio-rs/" [dependencies] -embedded-hal = "0.2.5" +embedded-hal = "1.0.0-alpha.11" fugit = "0.3.5" -rp2040-hal = "0.9.0-alpha.1" +rp2040-hal = { version = "0.9.0-alpha.1", features = [ "eh1_0_alpha", ] } pio = "0.2.0" smart-leds-trait = "0.2.1" nb = "1.0.0" diff --git a/src/lib.rs b/src/lib.rs index d0ed06d..b7df6ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,12 +13,12 @@ //! Bear in mind that you will have to take care of timing requirements //! yourself then. -use cortex_m; -use embedded_hal::timer::CountDown; +use cortex_m::prelude::_embedded_hal_timer_CountDown; use fugit::{ExtU32, HertzU32}; use rp2040_hal::{ gpio::AnyPin, pio::{PIOExt, StateMachineIndex, Tx, UninitStateMachine, PIO}, + timer::CountDown, }; use smart_leds_trait::SmartLedsWrite; @@ -143,7 +143,10 @@ where sm.start(); - Self { tx, _pin: I::from(pin) } + Self { + tx, + _pin: I::from(pin), + } } } @@ -210,20 +213,18 @@ where /// // Do other stuff here... /// }; ///``` -pub struct Ws2812 +pub struct Ws2812<'timer, P, SM, I> where - C: CountDown, I: AnyPin, P: PIOExt, SM: StateMachineIndex, { driver: Ws2812Direct, - cd: C, + cd: CountDown<'timer>, } -impl Ws2812 +impl<'timer, P, SM, I> Ws2812<'timer, P, SM, I> where - C: CountDown, I: AnyPin, P: PIOExt, SM: StateMachineIndex, @@ -234,15 +235,15 @@ where pio: &mut PIO

, sm: UninitStateMachine<(P, SM)>, clock_freq: fugit::HertzU32, - cd: C, - ) -> Ws2812 { + cd: CountDown<'timer>, + ) -> Ws2812<'timer, P, SM, I> { let driver = Ws2812Direct::new(pin, pio, sm, clock_freq); Self { driver, cd } } } -impl<'timer, P, SM, I> SmartLedsWrite for Ws2812, I> +impl<'timer, P, SM, I> SmartLedsWrite for Ws2812<'timer, P, SM, I> where I: AnyPin, P: PIOExt,