From 5c8c1b21462cae078ede1025a54b2c96b233d118 Mon Sep 17 00:00:00 2001 From: Tyler Gilbert Date: Fri, 29 Sep 2023 21:16:20 -0500 Subject: [PATCH] #Issue 1974 fix warnings --- embassy-stm32/src/rcc/f4.rs | 3 ++- embassy-stm32/src/sai/mod.rs | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/embassy-stm32/src/rcc/f4.rs b/embassy-stm32/src/rcc/f4.rs index 2c027ebe..17834784 100644 --- a/embassy-stm32/src/rcc/f4.rs +++ b/embassy-stm32/src/rcc/f4.rs @@ -52,6 +52,7 @@ fn setup_i2s_pll(_vco_in: u32, _plli2s: Option) -> Option { None } +#[cfg(not(any(stm32f410, stm32f411, stm32f412, stm32f413, stm32f423, stm32f446)))] fn calculate_sai_i2s_pll_values(vco_in: u32, max_div: u32, target: Option, ) -> Option<(u32, u32, u32)> { let min_div = 2; let target = match target { @@ -96,7 +97,7 @@ fn setup_i2s_pll(vco_in: u32, plli2s: Option) -> Option { } #[cfg(not(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f446, stm32f469, stm32f479)))] -fn setup_sai_pll(vco_in: u32, pllsai: Option) -> Option { +fn setup_sai_pll(vco_in: u32, _pllsai: Option) -> Option { None } diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs index 1fcee226..aa996a99 100644 --- a/embassy-stm32/src/sai/mod.rs +++ b/embassy-stm32/src/sai/mod.rs @@ -8,7 +8,6 @@ use crate::gpio::sealed::{AFType, Pin as _}; use crate::gpio::AnyPin; use crate::pac::sai::{vals, Sai as Regs}; use crate::rcc::RccPeripheral; -use crate::time::Hertz; use crate::{peripherals, Peripheral}; pub use crate::dma::word; @@ -702,8 +701,8 @@ impl<'d, T: Instance, C: Channel, W: word::Word> Sai<'d, T, C, W> { #[cfg(any(sai_v4))] { - /// Not totally clear from the datasheet if this is right - /// This is only used if using SyncEnable::External + // Not totally clear from the datasheet if this is right + // This is only used if using SyncEnable::External let value: u8 = if T::REGS.as_ptr() == stm32_metapac::SAI1.as_ptr() { 1 //this is SAI1, so sync with SAI2 } else { @@ -789,7 +788,7 @@ impl<'d, T: Instance, C: Channel, W: word::Word> Sai<'d, T, C, W> { } } - fn flush(&mut self) { + pub fn flush(&mut self) { let ch = T::REGS.ch(self.sub_block as usize); ch.cr1().modify(|w| w.set_saien(false)); #[cfg(any(sai_v1, sai_v2))] @@ -803,13 +802,13 @@ impl<'d, T: Instance, C: Channel, W: word::Word> Sai<'d, T, C, W> { ch.cr1().modify(|w| w.set_saien(true)); } - fn set_mute(&mut self, value: bool) { + pub fn set_mute(&mut self, value: bool) { let ch = T::REGS.ch(self.sub_block as usize); ch.cr2().modify(|w| w.set_mute(value)); } /// Reconfigures it with the supplied config. - pub fn reconfigure(&mut self, config: Config) {} + pub fn reconfigure(&mut self, _config: Config) {} pub fn get_current_config(&self) -> Config { Config::default() @@ -818,7 +817,7 @@ impl<'d, T: Instance, C: Channel, W: word::Word> Sai<'d, T, C, W> { pub async fn write(&mut self, data: &[W]) -> Result<(), Error> { match &mut self.ring_buffer { RingBuffer::Writable(buffer) => { - buffer.write_exact(data).await; + buffer.write_exact(data).await?; Ok(()) } _ => return Err(Error::NotATransmitter), @@ -828,7 +827,7 @@ impl<'d, T: Instance, C: Channel, W: word::Word> Sai<'d, T, C, W> { pub async fn read(&mut self, data: &mut [W]) -> Result<(), Error> { match &mut self.ring_buffer { RingBuffer::Readable(buffer) => { - buffer.read_exact(data).await; + buffer.read_exact(data).await?; Ok(()) } _ => Err(Error::NotAReceiver),