Skip to content

Commit

Permalink
Merge pull request #22 from Dicklessgreat/Dicklessgreat/issue19
Browse files Browse the repository at this point in the history
add .github/workflows/ci.yml
  • Loading branch information
Dicklessgreat authored Sep 8, 2024
2 parents 4afc330 + 87c6b0e commit 2b927f9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Continuous integration

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
CARGO_TERM_COLOR: always

jobs:
formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
target: thumbv7em-none-eabihf
- run: cargo fmt -- --check
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
target: thumbv7em-none-eabihf
- run: cargo clippy --no-default-features --features seed_1_1 -- --deny=warnings
- run: cargo clippy --no-default-features --features seed_1_2 -- --deny=warnings
15 changes: 8 additions & 7 deletions src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ use crate::codec::{Codec, Pins as CodecPins};
use defmt::info;
use defmt::unwrap;
use embassy_stm32 as hal;
use embassy_time::Timer;
use grounded::uninit::GroundedArrayCell;
use hal::sai::FifoThreshold;
use hal::sai::FrameSyncOffset;
use hal::sai::{BitOrder, SyncInput};
#[cfg(feature = "seed_1_1")]
use hal::time::Hertz;
use hal::{
peripherals,
sai::{
self, ClockStrobe, Config, DataSize, FrameSyncPolarity, MasterClockDivider, Mode, Sai,
StereoMono, TxRx,
self, ClockStrobe, DataSize, FrameSyncPolarity, MasterClockDivider, Mode, Sai, StereoMono,
TxRx,
},
time::Hertz,
};

// - global constants ---------------------------------------------------------

#[cfg(feature = "seed_1_1")]
const I2C_FS: Hertz = Hertz(100_000);
pub const BLOCK_LENGTH: usize = 32; // 32 samples
pub const HALF_DMA_BUFFER_LENGTH: usize = BLOCK_LENGTH * 2; // 2 channels
Expand Down Expand Up @@ -62,7 +63,7 @@ impl AudioPeripherals {

info!("set up sai_tx");
let (sub_block_rx, sub_block_tx) = hal::sai::split_subblocks(self.sai1);
let mut sai_rx_config = Config::default();
let mut sai_rx_config = sai::Config::default();
sai_rx_config.mode = Mode::Master;
sai_rx_config.tx_rx = TxRx::Receiver;
sai_rx_config.sync_output = true;
Expand Down Expand Up @@ -142,7 +143,7 @@ impl AudioPeripherals {
sai_tx_config.frame_sync_active_level_length = embassy_stm32::sai::word::U7(32);
sai_tx_config.fifo_threshold = FifoThreshold::Quarter;

let mut sai_rx_config = sai_tx_config.clone();
let mut sai_rx_config = sai_tx_config;
sai_rx_config.mode = Mode::Slave;
sai_rx_config.tx_rx = TxRx::Receiver;
sai_rx_config.sync_input = SyncInput::Internal;
Expand Down Expand Up @@ -238,7 +239,7 @@ impl<'a> Interface<'a> {
self.i2c.as_mut().unwrap(),
wm8731::WM8731::power_down(Codec::final_power_settings),
);
Timer::after_micros(10).await;
embassy_time::Timer::after_micros(10).await;
}

info!("start SAI");
Expand Down
1 change: 0 additions & 1 deletion src/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::led::UserLed;
use crate::pins::*;
use crate::usb::UsbPeripherals;
use crate::{audio::AudioPeripherals, sdram::SdRamBuilder};
use embassy_stm32 as hal;
pub struct DaisyBoard<'a> {
pub pins: DaisyPins,
pub user_led: UserLed<'a>,
Expand Down

0 comments on commit 2b927f9

Please sign in to comment.