diff options
| author | Caleb Jamison <[email protected]> | 2024-02-10 17:00:10 -0500 |
|---|---|---|
| committer | Caleb Jamison <[email protected]> | 2024-02-10 17:00:10 -0500 |
| commit | b4dc406e199a7e4aafcdd601aaef999c6b7ba590 (patch) | |
| tree | d9fdcda22a0b6ba1bdc490f630fdc4fc33a0bc02 /examples/rp | |
| parent | c873dcbb20f06e00659ab1c984ce7a753aaea7dc (diff) | |
Switch to ticker
Diffstat (limited to 'examples/rp')
| -rw-r--r-- | examples/rp/src/bin/pio_ws2812.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/rp/src/bin/pio_ws2812.rs b/examples/rp/src/bin/pio_ws2812.rs index e9a3d0e41..ac145933c 100644 --- a/examples/rp/src/bin/pio_ws2812.rs +++ b/examples/rp/src/bin/pio_ws2812.rs | |||
| @@ -12,7 +12,7 @@ use embassy_rp::pio::{ | |||
| 12 | Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftConfig, ShiftDirection, StateMachine, | 12 | Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftConfig, ShiftDirection, StateMachine, |
| 13 | }; | 13 | }; |
| 14 | use embassy_rp::{bind_interrupts, clocks, into_ref, Peripheral, PeripheralRef}; | 14 | use embassy_rp::{bind_interrupts, clocks, into_ref, Peripheral, PeripheralRef}; |
| 15 | use embassy_time::Timer; | 15 | use embassy_time::{Duration, Ticker, Timer}; |
| 16 | use fixed::types::U24F8; | 16 | use fixed::types::U24F8; |
| 17 | use fixed_macro::fixed; | 17 | use fixed_macro::fixed; |
| 18 | use smart_leds::RGB8; | 18 | use smart_leds::RGB8; |
| @@ -145,6 +145,7 @@ async fn main(_spawner: Spawner) { | |||
| 145 | let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16); | 145 | let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16); |
| 146 | 146 | ||
| 147 | // Loop forever making RGB values and pushing them out to the WS2812. | 147 | // Loop forever making RGB values and pushing them out to the WS2812. |
| 148 | let mut ticker = Ticker::every(Duration::from_millis(10)); | ||
| 148 | loop { | 149 | loop { |
| 149 | for j in 0..(256 * 5) { | 150 | for j in 0..(256 * 5) { |
| 150 | debug!("New Colors:"); | 151 | debug!("New Colors:"); |
| @@ -154,7 +155,7 @@ async fn main(_spawner: Spawner) { | |||
| 154 | } | 155 | } |
| 155 | ws2812.write(&data).await; | 156 | ws2812.write(&data).await; |
| 156 | 157 | ||
| 157 | Timer::after_millis(10).await; | 158 | ticker.next().await; |
| 158 | } | 159 | } |
| 159 | } | 160 | } |
| 160 | } | 161 | } |
