diff options
| author | Dennis Ranke <[email protected]> | 2024-01-20 16:35:09 +0100 |
|---|---|---|
| committer | Dennis Ranke <[email protected]> | 2024-01-20 16:35:09 +0100 |
| commit | 7931fcfb3d3211b9c7e46b43cebe48c433893b15 (patch) | |
| tree | 400a1beedda794ffd350555b8944784db12e1bf4 /examples | |
| parent | 69d4b428412fb0252d2a7eb807f3439e999bccfb (diff) | |
fix wrong formatting due to not using nightly rustfmt
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/src/bin/pio_i2s.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/examples/rp/src/bin/pio_i2s.rs b/examples/rp/src/bin/pio_i2s.rs index 66802c8b7..cf60e5b30 100644 --- a/examples/rp/src/bin/pio_i2s.rs +++ b/examples/rp/src/bin/pio_i2s.rs | |||
| @@ -12,17 +12,13 @@ | |||
| 12 | 12 | ||
| 13 | use core::mem; | 13 | use core::mem; |
| 14 | 14 | ||
| 15 | use defmt_rtt as _; | ||
| 16 | use embassy_executor::Spawner; | 15 | use embassy_executor::Spawner; |
| 17 | use embassy_rp::{ | 16 | use embassy_rp::peripherals::PIO0; |
| 18 | bind_interrupts, | 17 | use embassy_rp::pio::{Config, FifoJoin, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 19 | peripherals::PIO0, | 18 | use embassy_rp::{bind_interrupts, Peripheral}; |
| 20 | pio::{Config, FifoJoin, InterruptHandler, Pio, ShiftConfig, ShiftDirection}, | ||
| 21 | Peripheral, | ||
| 22 | }; | ||
| 23 | use fixed::traits::ToFixed; | 19 | use fixed::traits::ToFixed; |
| 24 | use panic_probe as _; | ||
| 25 | use static_cell::StaticCell; | 20 | use static_cell::StaticCell; |
| 21 | use {defmt_rtt as _, panic_probe as _}; | ||
| 26 | 22 | ||
| 27 | bind_interrupts!(struct Irqs { | 23 | bind_interrupts!(struct Irqs { |
| 28 | PIO0_IRQ_0 => InterruptHandler<PIO0>; | 24 | PIO0_IRQ_0 => InterruptHandler<PIO0>; |
| @@ -115,7 +111,7 @@ async fn main(_spawner: Spawner) { | |||
| 115 | fade_value += (fade_target - fade_value) >> 14; | 111 | fade_value += (fade_target - fade_value) >> 14; |
| 116 | // generate triangle wave with amplitude and frequency based on fade value | 112 | // generate triangle wave with amplitude and frequency based on fade value |
| 117 | phase = (phase + (fade_value >> 22)) & 0xffff; | 113 | phase = (phase + (fade_value >> 22)) & 0xffff; |
| 118 | let triangle_sample = (phase as i16 as i32).abs() - 16384; | 114 | let triangle_sample = (phase as i16 as i32).abs() - 16384; |
| 119 | let sample = (triangle_sample * (fade_value >> 15)) >> 16; | 115 | let sample = (triangle_sample * (fade_value >> 15)) >> 16; |
| 120 | // duplicate mono sample into lower and upper half of dma word | 116 | // duplicate mono sample into lower and upper half of dma word |
| 121 | *s = (sample as u16 as u32) * 0x10001; | 117 | *s = (sample as u16 as u32) * 0x10001; |
| @@ -127,4 +123,3 @@ async fn main(_spawner: Spawner) { | |||
| 127 | mem::swap(&mut back_buffer, &mut front_buffer); | 123 | mem::swap(&mut back_buffer, &mut front_buffer); |
| 128 | } | 124 | } |
| 129 | } | 125 | } |
| 130 | |||
