diff options
| -rw-r--r-- | examples/rp/src/bin/pio_ws2812.rs (renamed from examples/rp/src/bin/ws2812-pio.rs) | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/rp/src/bin/ws2812-pio.rs b/examples/rp/src/bin/pio_ws2812.rs index f4c2d6313..4915c7e92 100644 --- a/examples/rp/src/bin/ws2812-pio.rs +++ b/examples/rp/src/bin/pio_ws2812.rs | |||
| @@ -48,6 +48,8 @@ impl<'d, P: Instance, const S: usize> Ws2812<'d, P, S> { | |||
| 48 | 48 | ||
| 49 | // Pin config | 49 | // Pin config |
| 50 | let out_pin = pio.make_pio_pin(pin); | 50 | let out_pin = pio.make_pio_pin(pin); |
| 51 | cfg.set_out_pins(&[&out_pin]); | ||
| 52 | cfg.set_set_pins(&[&out_pin]); | ||
| 51 | 53 | ||
| 52 | let relocated = RelocatedProgram::new(&prg); | 54 | let relocated = RelocatedProgram::new(&prg); |
| 53 | cfg.use_program(&pio.load_program(&relocated), &[&out_pin]); | 55 | cfg.use_program(&pio.load_program(&relocated), &[&out_pin]); |
| @@ -76,7 +78,9 @@ impl<'d, P: Instance, const S: usize> Ws2812<'d, P, S> { | |||
| 76 | pub async fn write(&mut self, colors: &[RGB8]) { | 78 | pub async fn write(&mut self, colors: &[RGB8]) { |
| 77 | for color in colors { | 79 | for color in colors { |
| 78 | let word = (u32::from(color.g) << 24) | (u32::from(color.r) << 16) | (u32::from(color.b) << 8); | 80 | let word = (u32::from(color.g) << 24) | (u32::from(color.r) << 16) | (u32::from(color.b) << 8); |
| 79 | self.sm.tx().wait_push(word).await; | 81 | if !self.sm.tx().try_push(word) { |
| 82 | self.sm.tx().wait_push(word).await; | ||
| 83 | } | ||
| 80 | } | 84 | } |
| 81 | } | 85 | } |
| 82 | } | 86 | } |
