Skip to content

Commit

Permalink
i2s_parallel for esp32 - works sync 16bit (still WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
liebman committed Oct 13, 2024
1 parent d550670 commit 870c5c5
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions esp-hal/src/i2s_parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl<'d, I: Instance, DM: Mode> I2sParallel<'d, I, DM> {
})
}

#[cfg(all(feature = "debug", feature = "log"))]
/// Dump the I2S peripheral configuration
pub fn dump(&self) {
I::dump();
Expand Down Expand Up @@ -305,6 +306,7 @@ where
(i2s, BUF::from_view(view))
}

#[cfg(all(feature = "debug", feature = "log"))]
/// Dump the I2S peripheral configuration
pub fn dump(&self) {
I::dump();
Expand Down Expand Up @@ -422,11 +424,13 @@ pub trait Instance: Signals + RegBlock {
}

fn tx_wait_done() {
while !Self::is_tx_done() {
let r = Self::register_block();
while r.state().read().tx_idle().bit_is_clear() {
// wait
}
Self::tx_stop();
}

r.conf().modify(|_, w| w.tx_start().clear_bit());
}

fn setup(frequency: impl Into<fugit::HertzU32>, bits: u8) {
let frequency: HertzU32 = frequency.into();
Expand Down Expand Up @@ -490,23 +494,30 @@ pub trait Instance: Signals + RegBlock {
w.tx_right_first().set_bit()
});
r.timing().reset();

r.pd_conf().modify(|_, w| {
w.fifo_force_pu().set_bit();
w.fifo_force_pd().clear_bit()
});

}

/// Dump the I2S peripheral configuration
#[cfg(all(feature = "debug", feature = "log"))]
/// Dump the I2S peripheral configuration
fn dump() {
let r = Self::register_block();
log::info!("conf: {:#?}", r.conf().read());
log::info!("conf1: {:#?}", r.conf1().read());
log::info!("conf2: {:#?}", r.conf2().read());
log::info!("conf_chan: {:#?}", r.conf_chan().read());
log::info!("timing: {:#?}", r.timing().read());
log::info!("sample_rate_conf: {:#?}", r.sample_rate_conf().read());
log::info!("fifo_conf: {:#?}", r.fifo_conf().read());
log::info!("lc_conf: {:#?}", r.lc_conf().read());
log::info!("int_raw: {:#?}", r.int_raw().read());
log::info!("int_st: {:#?}", r.int_st().read());
log::info!("int_ena: {:#?}", r.int_ena().read());
log::info!("state: {:#?}", r.state().read());
info!("conf: {:#?}", r.conf().read());
info!("conf1: {:#?}", r.conf1().read());
info!("conf2: {:#?}", r.conf2().read());
info!("conf_chan: {:#?}", r.conf_chan().read());
info!("timing: {:#?}", r.timing().read());
info!("sample_rate_conf: {:#?}", r.sample_rate_conf().read());
info!("fifo_conf: {:#?}", r.fifo_conf().read());
info!("lc_conf: {:#?}", r.lc_conf().read());
info!("int_raw: {:#?}", r.int_raw().read());
info!("int_st: {:#?}", r.int_st().read());
info!("int_ena: {:#?}", r.int_ena().read());
info!("state: {:#?}", r.state().read());
}

}
Expand Down

0 comments on commit 870c5c5

Please sign in to comment.