#Issue 1974 fix warnings

This commit is contained in:
Tyler Gilbert 2023-09-29 21:16:20 -05:00
parent 2addfc4b86
commit 5c8c1b2146
2 changed files with 9 additions and 9 deletions

View File

@ -52,6 +52,7 @@ fn setup_i2s_pll(_vco_in: u32, _plli2s: Option<u32>) -> Option<u32> {
None None
} }
#[cfg(not(any(stm32f410, stm32f411, stm32f412, stm32f413, stm32f423, stm32f446)))]
fn calculate_sai_i2s_pll_values(vco_in: u32, max_div: u32, target: Option<u32>, ) -> Option<(u32, u32, u32)> { fn calculate_sai_i2s_pll_values(vco_in: u32, max_div: u32, target: Option<u32>, ) -> Option<(u32, u32, u32)> {
let min_div = 2; let min_div = 2;
let target = match target { let target = match target {
@ -96,7 +97,7 @@ fn setup_i2s_pll(vco_in: u32, plli2s: Option<u32>) -> Option<u32> {
} }
#[cfg(not(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f446, stm32f469, stm32f479)))] #[cfg(not(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f446, stm32f469, stm32f479)))]
fn setup_sai_pll(vco_in: u32, pllsai: Option<u32>) -> Option<u32> { fn setup_sai_pll(vco_in: u32, _pllsai: Option<u32>) -> Option<u32> {
None None
} }

View File

@ -8,7 +8,6 @@ use crate::gpio::sealed::{AFType, Pin as _};
use crate::gpio::AnyPin; use crate::gpio::AnyPin;
use crate::pac::sai::{vals, Sai as Regs}; use crate::pac::sai::{vals, Sai as Regs};
use crate::rcc::RccPeripheral; use crate::rcc::RccPeripheral;
use crate::time::Hertz;
use crate::{peripherals, Peripheral}; use crate::{peripherals, Peripheral};
pub use crate::dma::word; 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))] #[cfg(any(sai_v4))]
{ {
/// Not totally clear from the datasheet if this is right // Not totally clear from the datasheet if this is right
/// This is only used if using SyncEnable::External // This is only used if using SyncEnable::External
let value: u8 = if T::REGS.as_ptr() == stm32_metapac::SAI1.as_ptr() { let value: u8 = if T::REGS.as_ptr() == stm32_metapac::SAI1.as_ptr() {
1 //this is SAI1, so sync with SAI2 1 //this is SAI1, so sync with SAI2
} else { } 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); let ch = T::REGS.ch(self.sub_block as usize);
ch.cr1().modify(|w| w.set_saien(false)); ch.cr1().modify(|w| w.set_saien(false));
#[cfg(any(sai_v1, sai_v2))] #[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)); 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); let ch = T::REGS.ch(self.sub_block as usize);
ch.cr2().modify(|w| w.set_mute(value)); ch.cr2().modify(|w| w.set_mute(value));
} }
/// Reconfigures it with the supplied config. /// 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 { pub fn get_current_config(&self) -> Config {
Config::default() 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> { pub async fn write(&mut self, data: &[W]) -> Result<(), Error> {
match &mut self.ring_buffer { match &mut self.ring_buffer {
RingBuffer::Writable(buffer) => { RingBuffer::Writable(buffer) => {
buffer.write_exact(data).await; buffer.write_exact(data).await?;
Ok(()) Ok(())
} }
_ => return Err(Error::NotATransmitter), _ => 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> { pub async fn read(&mut self, data: &mut [W]) -> Result<(), Error> {
match &mut self.ring_buffer { match &mut self.ring_buffer {
RingBuffer::Readable(buffer) => { RingBuffer::Readable(buffer) => {
buffer.read_exact(data).await; buffer.read_exact(data).await?;
Ok(()) Ok(())
} }
_ => Err(Error::NotAReceiver), _ => Err(Error::NotAReceiver),