Skip to content

Commit

Permalink
fix wrong formatting due to not using nightly rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
exoticorn committed Jan 20, 2024
1 parent 69d4b42 commit 7931fcf
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions examples/rp/src/bin/pio_i2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@

use core::mem;

use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_rp::{
bind_interrupts,
peripherals::PIO0,
pio::{Config, FifoJoin, InterruptHandler, Pio, ShiftConfig, ShiftDirection},
Peripheral,
};
use embassy_rp::peripherals::PIO0;
use embassy_rp::pio::{Config, FifoJoin, InterruptHandler, Pio, ShiftConfig, ShiftDirection};
use embassy_rp::{bind_interrupts, Peripheral};
use fixed::traits::ToFixed;
use panic_probe as _;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};

bind_interrupts!(struct Irqs {
PIO0_IRQ_0 => InterruptHandler<PIO0>;
Expand Down Expand Up @@ -115,7 +111,7 @@ async fn main(_spawner: Spawner) {
fade_value += (fade_target - fade_value) >> 14;
// generate triangle wave with amplitude and frequency based on fade value
phase = (phase + (fade_value >> 22)) & 0xffff;
let triangle_sample = (phase as i16 as i32).abs() - 16384;
let triangle_sample = (phase as i16 as i32).abs() - 16384;
let sample = (triangle_sample * (fade_value >> 15)) >> 16;
// duplicate mono sample into lower and upper half of dma word
*s = (sample as u16 as u32) * 0x10001;
Expand All @@ -127,4 +123,3 @@ async fn main(_spawner: Spawner) {
mem::swap(&mut back_buffer, &mut front_buffer);
}
}

0 comments on commit 7931fcf

Please sign in to comment.