aboutsummaryrefslogtreecommitdiff
path: root/examples/rp
diff options
context:
space:
mode:
authorDennis Ranke <[email protected]>2024-01-20 16:35:09 +0100
committerDennis Ranke <[email protected]>2024-01-20 16:35:09 +0100
commit7931fcfb3d3211b9c7e46b43cebe48c433893b15 (patch)
tree400a1beedda794ffd350555b8944784db12e1bf4 /examples/rp
parent69d4b428412fb0252d2a7eb807f3439e999bccfb (diff)
fix wrong formatting due to not using nightly rustfmt
Diffstat (limited to 'examples/rp')
-rw-r--r--examples/rp/src/bin/pio_i2s.rs15
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
13use core::mem; 13use core::mem;
14 14
15use defmt_rtt as _;
16use embassy_executor::Spawner; 15use embassy_executor::Spawner;
17use embassy_rp::{ 16use embassy_rp::peripherals::PIO0;
18 bind_interrupts, 17use embassy_rp::pio::{Config, FifoJoin, InterruptHandler, Pio, ShiftConfig, ShiftDirection};
19 peripherals::PIO0, 18use embassy_rp::{bind_interrupts, Peripheral};
20 pio::{Config, FifoJoin, InterruptHandler, Pio, ShiftConfig, ShiftDirection},
21 Peripheral,
22};
23use fixed::traits::ToFixed; 19use fixed::traits::ToFixed;
24use panic_probe as _;
25use static_cell::StaticCell; 20use static_cell::StaticCell;
21use {defmt_rtt as _, panic_probe as _};
26 22
27bind_interrupts!(struct Irqs { 23bind_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