1313//! Bear in mind that you will have to take care of timing requirements
1414//! yourself then.
1515
16- use cortex_m;
17- use embedded_hal:: timer:: CountDown ;
16+ use cortex_m:: prelude:: _embedded_hal_timer_CountDown;
1817use fugit:: { ExtU32 , HertzU32 } ;
1918use rp2040_hal:: {
2019 gpio:: AnyPin ,
2120 pio:: { PIOExt , StateMachineIndex , Tx , UninitStateMachine , PIO } ,
21+ timer:: CountDown ,
2222} ;
2323use smart_leds_trait:: SmartLedsWrite ;
2424
@@ -143,7 +143,10 @@ where
143143
144144 sm. start ( ) ;
145145
146- Self { tx, _pin : I :: from ( pin) }
146+ Self {
147+ tx,
148+ _pin : I :: from ( pin) ,
149+ }
147150 }
148151}
149152
@@ -210,20 +213,18 @@ where
210213/// // Do other stuff here...
211214/// };
212215///```
213- pub struct Ws2812 < P , SM , C , I >
216+ pub struct Ws2812 < ' timer , P , SM , I >
214217where
215- C : CountDown ,
216218 I : AnyPin < Function = P :: PinFunction > ,
217219 P : PIOExt ,
218220 SM : StateMachineIndex ,
219221{
220222 driver : Ws2812Direct < P , SM , I > ,
221- cd : C ,
223+ cd : CountDown < ' timer > ,
222224}
223225
224- impl < P , SM , C , I > Ws2812 < P , SM , C , I >
226+ impl < ' timer , P , SM , I > Ws2812 < ' timer , P , SM , I >
225227where
226- C : CountDown ,
227228 I : AnyPin < Function = P :: PinFunction > ,
228229 P : PIOExt ,
229230 SM : StateMachineIndex ,
@@ -234,15 +235,15 @@ where
234235 pio : & mut PIO < P > ,
235236 sm : UninitStateMachine < ( P , SM ) > ,
236237 clock_freq : fugit:: HertzU32 ,
237- cd : C ,
238- ) -> Ws2812 < P , SM , C , I > {
238+ cd : CountDown < ' timer > ,
239+ ) -> Ws2812 < ' timer , P , SM , I > {
239240 let driver = Ws2812Direct :: new ( pin, pio, sm, clock_freq) ;
240241
241242 Self { driver, cd }
242243 }
243244}
244245
245- impl < ' timer , P , SM , I > SmartLedsWrite for Ws2812 < P , SM , rp2040_hal :: timer :: CountDown < ' timer > , I >
246+ impl < ' timer , P , SM , I > SmartLedsWrite for Ws2812 < ' timer , P , SM , I >
246247where
247248 I : AnyPin < Function = P :: PinFunction > ,
248249 P : PIOExt ,
0 commit comments