diff options
| author | MatrixSenpai <[email protected]> | 2025-05-22 11:04:30 -0500 |
|---|---|---|
| committer | MatrixSenpai <[email protected]> | 2025-05-22 11:04:30 -0500 |
| commit | 7eaea84fb769f739f884bc0a474b518b65c126e4 (patch) | |
| tree | 20f054b6d24d4fd6c7dfd1c22ec71e92da80ae7f | |
| parent | 9baf5fc5eb8b317c7ac86ddd7bdc7434fbe7c26c (diff) | |
rustfmt
| -rw-r--r-- | embassy-rp/src/pio_programs/ws2812.rs | 9 |
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 |
| 55 | pub struct RgbPioWs2812<'d, P: Instance, const S: usize, const N: usize> { | 55 | pub 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 | ||
| 60 | impl<'d, P: Instance, const S: usize, const N: usize> RgbPioWs2812<'d, P, S, N> { | 60 | impl<'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 | ||
