Fix build

This commit is contained in:
Christian Perez Llamas 2022-11-19 01:38:03 +01:00
parent 16838f8a66
commit 64e8cfef8e
4 changed files with 15 additions and 8 deletions

View File

@ -138,6 +138,9 @@ embassy_hal_common::peripherals! {
// QDEC // QDEC
QDEC, QDEC,
// I2S
I2S,
} }
impl_uarte!(UARTE0, UARTE0, UARTE0_UART0); impl_uarte!(UARTE0, UARTE0, UARTE0_UART0);
@ -234,6 +237,8 @@ impl_saadc_input!(P0_29, ANALOG_INPUT5);
impl_saadc_input!(P0_30, ANALOG_INPUT6); impl_saadc_input!(P0_30, ANALOG_INPUT6);
impl_saadc_input!(P0_31, ANALOG_INPUT7); impl_saadc_input!(P0_31, ANALOG_INPUT7);
impl_i2s!(I2S, I2S, I2S);
pub mod irqs { pub mod irqs {
use embassy_cortex_m::interrupt::_export::declare; use embassy_cortex_m::interrupt::_export::declare;
@ -274,6 +279,6 @@ pub mod irqs {
declare!(PWM2); declare!(PWM2);
declare!(SPIM2_SPIS2_SPI2); declare!(SPIM2_SPIS2_SPI2);
declare!(RTC2); declare!(RTC2);
declare!(I2S);
declare!(FPU); declare!(FPU);
declare!(I2S);
} }

View File

@ -161,6 +161,9 @@ embassy_hal_common::peripherals! {
// PDM // PDM
PDM, PDM,
// I2S
I2S,
} }
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
@ -280,6 +283,8 @@ impl_saadc_input!(P0_29, ANALOG_INPUT5);
impl_saadc_input!(P0_30, ANALOG_INPUT6); impl_saadc_input!(P0_30, ANALOG_INPUT6);
impl_saadc_input!(P0_31, ANALOG_INPUT7); impl_saadc_input!(P0_31, ANALOG_INPUT7);
impl_i2s!(I2S, I2S, I2S);
pub mod irqs { pub mod irqs {
use embassy_cortex_m::interrupt::_export::declare; use embassy_cortex_m::interrupt::_export::declare;
@ -320,10 +325,10 @@ pub mod irqs {
declare!(PWM2); declare!(PWM2);
declare!(SPIM2_SPIS2_SPI2); declare!(SPIM2_SPIS2_SPI2);
declare!(RTC2); declare!(RTC2);
declare!(I2S);
declare!(FPU); declare!(FPU);
declare!(USBD); declare!(USBD);
declare!(UARTE1); declare!(UARTE1);
declare!(PWM3); declare!(PWM3);
declare!(SPIM3); declare!(SPIM3);
declare!(I2S);
} }

View File

@ -330,7 +330,6 @@ pub mod irqs {
declare!(PWM2); declare!(PWM2);
declare!(SPIM2_SPIS2_SPI2); declare!(SPIM2_SPIS2_SPI2);
declare!(RTC2); declare!(RTC2);
declare!(I2S);
declare!(FPU); declare!(FPU);
declare!(USBD); declare!(USBD);
declare!(UARTE1); declare!(UARTE1);
@ -338,4 +337,5 @@ pub mod irqs {
declare!(CRYPTOCELL); declare!(CRYPTOCELL);
declare!(PWM3); declare!(PWM3);
declare!(SPIM3); declare!(SPIM3);
declare!(I2S);
} }

View File

@ -14,13 +14,10 @@ use embassy_hal_common::{into_ref, PeripheralRef};
use crate::gpio::{AnyPin, Pin as GpioPin}; use crate::gpio::{AnyPin, Pin as GpioPin};
use crate::interrupt::Interrupt; use crate::interrupt::Interrupt;
use crate::pac::i2s::RegisterBlock; use crate::pac::i2s::RegisterBlock;
use crate::Peripheral; use crate::{EASY_DMA_SIZE, Peripheral};
// TODO: Define those in lib.rs somewhere else // TODO: Define those in lib.rs somewhere else
/// I2S EasyDMA MAXCNT bit length = 14
const MAX_DMA_MAXCNT: u32 = 1 << 14;
/// Limits for Easy DMA - it can only read from data ram /// Limits for Easy DMA - it can only read from data ram
pub const SRAM_LOWER: usize = 0x2000_0000; pub const SRAM_LOWER: usize = 0x2000_0000;
pub const SRAM_UPPER: usize = 0x3000_0000; pub const SRAM_UPPER: usize = 0x3000_0000;
@ -956,7 +953,7 @@ impl<T: Instance> Device<T> {
Err(Error::BufferLengthMisaligned) Err(Error::BufferLengthMisaligned)
} else if (ptr as usize) < SRAM_LOWER || (ptr as usize) > SRAM_UPPER { } else if (ptr as usize) < SRAM_LOWER || (ptr as usize) > SRAM_UPPER {
Err(Error::BufferNotInDataMemory) Err(Error::BufferNotInDataMemory)
} else if maxcnt > MAX_DMA_MAXCNT { } else if maxcnt as usize > EASY_DMA_SIZE {
Err(Error::BufferTooLong) Err(Error::BufferTooLong)
} else { } else {
Ok((ptr, maxcnt)) Ok((ptr, maxcnt))