diff options
Diffstat (limited to 'embassy-stm32/src/fmc.rs')
| -rw-r--r-- | embassy-stm32/src/fmc.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/embassy-stm32/src/fmc.rs b/embassy-stm32/src/fmc.rs index 83b49a3dd..71ca775cb 100644 --- a/embassy-stm32/src/fmc.rs +++ b/embassy-stm32/src/fmc.rs | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | //! Flexible Memory Controller (FMC) / Flexible Static Memory Controller (FSMC) | 1 | //! Flexible Memory Controller (FMC) / Flexible Static Memory Controller (FSMC) |
| 2 | use core::marker::PhantomData; | 2 | use core::marker::PhantomData; |
| 3 | 3 | ||
| 4 | use embassy_hal_internal::into_ref; | 4 | use embassy_hal_internal::PeripheralType; |
| 5 | 5 | ||
| 6 | use crate::gpio::{AfType, OutputType, Pull, Speed}; | 6 | use crate::gpio::{AfType, OutputType, Pull, Speed}; |
| 7 | use crate::{rcc, Peripheral}; | 7 | use crate::{rcc, Peri}; |
| 8 | 8 | ||
| 9 | /// FMC driver | 9 | /// FMC driver |
| 10 | pub struct Fmc<'d, T: Instance> { | 10 | pub struct Fmc<'d, T: Instance> { |
| @@ -21,7 +21,7 @@ where | |||
| 21 | /// | 21 | /// |
| 22 | /// **Note:** This is currently used to provide access to some basic FMC functions | 22 | /// **Note:** This is currently used to provide access to some basic FMC functions |
| 23 | /// for manual configuration for memory types that stm32-fmc does not support. | 23 | /// for manual configuration for memory types that stm32-fmc does not support. |
| 24 | pub fn new_raw(_instance: impl Peripheral<P = T> + 'd) -> Self { | 24 | pub fn new_raw(_instance: Peri<'d, T>) -> Self { |
| 25 | Self { peri: PhantomData } | 25 | Self { peri: PhantomData } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| @@ -74,8 +74,7 @@ where | |||
| 74 | 74 | ||
| 75 | macro_rules! config_pins { | 75 | macro_rules! config_pins { |
| 76 | ($($pin:ident),*) => { | 76 | ($($pin:ident),*) => { |
| 77 | into_ref!($($pin),*); | 77 | $( |
| 78 | $( | ||
| 79 | $pin.set_as_af($pin.af_num(), AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up)); | 78 | $pin.set_as_af($pin.af_num(), AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up)); |
| 80 | )* | 79 | )* |
| 81 | }; | 80 | }; |
| @@ -92,12 +91,12 @@ macro_rules! fmc_sdram_constructor { | |||
| 92 | )) => { | 91 | )) => { |
| 93 | /// Create a new FMC instance. | 92 | /// Create a new FMC instance. |
| 94 | pub fn $name<CHIP: stm32_fmc::SdramChip>( | 93 | pub fn $name<CHIP: stm32_fmc::SdramChip>( |
| 95 | _instance: impl Peripheral<P = T> + 'd, | 94 | _instance: Peri<'d, T>, |
| 96 | $($addr_pin_name: impl Peripheral<P = impl $addr_signal<T>> + 'd),*, | 95 | $($addr_pin_name: Peri<'d, impl $addr_signal<T>>),*, |
| 97 | $($ba_pin_name: impl Peripheral<P = impl $ba_signal<T>> + 'd),*, | 96 | $($ba_pin_name: Peri<'d, impl $ba_signal<T>>),*, |
| 98 | $($d_pin_name: impl Peripheral<P = impl $d_signal<T>> + 'd),*, | 97 | $($d_pin_name: Peri<'d, impl $d_signal<T>>),*, |
| 99 | $($nbl_pin_name: impl Peripheral<P = impl $nbl_signal<T>> + 'd),*, | 98 | $($nbl_pin_name: Peri<'d, impl $nbl_signal<T>>),*, |
| 100 | $($ctrl_pin_name: impl Peripheral<P = impl $ctrl_signal<T>> + 'd),*, | 99 | $($ctrl_pin_name: Peri<'d, impl $ctrl_signal<T>>),*, |
| 101 | chip: CHIP | 100 | chip: CHIP |
| 102 | ) -> stm32_fmc::Sdram<Fmc<'d, T>, CHIP> { | 101 | ) -> stm32_fmc::Sdram<Fmc<'d, T>, CHIP> { |
| 103 | 102 | ||
| @@ -245,7 +244,7 @@ trait SealedInstance: crate::rcc::RccPeripheral { | |||
| 245 | 244 | ||
| 246 | /// FMC instance trait. | 245 | /// FMC instance trait. |
| 247 | #[allow(private_bounds)] | 246 | #[allow(private_bounds)] |
| 248 | pub trait Instance: SealedInstance + 'static {} | 247 | pub trait Instance: SealedInstance + PeripheralType + 'static {} |
| 249 | 248 | ||
| 250 | foreach_peripheral!( | 249 | foreach_peripheral!( |
| 251 | (fmc, $inst:ident) => { | 250 | (fmc, $inst:ident) => { |
