mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 00:02:28 +00:00
Switch to ticker
This commit is contained in:
parent
c873dcbb20
commit
b4dc406e19
@ -12,7 +12,7 @@ use embassy_rp::pio::{
|
||||
Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftConfig, ShiftDirection, StateMachine,
|
||||
};
|
||||
use embassy_rp::{bind_interrupts, clocks, into_ref, Peripheral, PeripheralRef};
|
||||
use embassy_time::Timer;
|
||||
use embassy_time::{Duration, Ticker, Timer};
|
||||
use fixed::types::U24F8;
|
||||
use fixed_macro::fixed;
|
||||
use smart_leds::RGB8;
|
||||
@ -145,6 +145,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16);
|
||||
|
||||
// Loop forever making RGB values and pushing them out to the WS2812.
|
||||
let mut ticker = Ticker::every(Duration::from_millis(10));
|
||||
loop {
|
||||
for j in 0..(256 * 5) {
|
||||
debug!("New Colors:");
|
||||
@ -154,7 +155,7 @@ async fn main(_spawner: Spawner) {
|
||||
}
|
||||
ws2812.write(&data).await;
|
||||
|
||||
Timer::after_millis(10).await;
|
||||
ticker.next().await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user