aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-rp')
-rw-r--r--embassy-rp/src/pio_programs/ws2812.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/embassy-rp/src/pio_programs/ws2812.rs b/embassy-rp/src/pio_programs/ws2812.rs
index f257bfcdc..37dd1c4e0 100644
--- a/embassy-rp/src/pio_programs/ws2812.rs
+++ b/embassy-rp/src/pio_programs/ws2812.rs
@@ -52,12 +52,12 @@ impl<'a, PIO: Instance> PioWs2812Program<'a, PIO> {
52 52
53/// Pio backed RGB ws2812 driver 53/// Pio backed RGB ws2812 driver
54/// Const N is the number of ws2812 leds attached to this pin 54/// Const N is the number of ws2812 leds attached to this pin
55pub struct RgbPioWs2812<'d, P: Instance, const S: usize, const N: usize> { 55pub struct PioWs2812<'d, P: Instance, const S: usize, const N: usize> {
56 dma: Peri<'d, AnyChannel>, 56 dma: Peri<'d, AnyChannel>,
57 sm: StateMachine<'d, P, S>, 57 sm: StateMachine<'d, P, S>,
58} 58}
59 59
60impl<'d, P: Instance, const S: usize, const N: usize> RgbPioWs2812<'d, P, S, N> { 60impl<'d, P: Instance, const S: usize, const N: usize> PioWs2812<'d, P, S, N> {
61 /// Configure a pio state machine to use the loaded ws2812 program. 61 /// Configure a pio state machine to use the loaded ws2812 program.
62 pub fn new( 62 pub fn new(
63 pio: &mut Common<'d, P>, 63 pio: &mut Common<'d, P>,
@@ -164,7 +164,10 @@ impl<'d, P: Instance, const S: usize, const N: usize> RgbwPioWs2812<'d, P, S, N>
164 // Precompute the word bytes from the colors 164 // Precompute the word bytes from the colors
165 let mut words = [0u32; N]; 165 let mut words = [0u32; N];
166 for i in 0..N { 166 for i in 0..N {
167 let word = (u32::from(colors[i].g) << 24) | (u32::from(colors[i].r) << 16) | (u32::from(colors[i].b) << 8) | u32::from(colors[i].a.0); 167 let word = (u32::from(colors[i].g) << 24)
168 | (u32::from(colors[i].r) << 16)
169 | (u32::from(colors[i].b) << 8)
170 | u32::from(colors[i].a.0);
168 words[i] = word; 171 words[i] = word;
169 } 172 }
170 173