wip: fmac

This commit is contained in:
xoviat 2023-04-22 22:39:56 -05:00
parent fb27594b2e
commit 8d5d988ef8
2 changed files with 37 additions and 0 deletions

35
embassy-stm32/src/fmac.rs Normal file
View File

@ -0,0 +1,35 @@
use embassy_hal_common::{into_ref, PeripheralRef};
use crate::pac::FMAC;
use crate::Peripheral;
pub struct FMAC<'d, T: Instance, Tx, Rx> {
_peri: PeripheralRef<'d, T>,
txdma: PeripheralRef<'d, Tx>,
rxdma: PeripheralRef<'d, Rx>,
}
impl<'d, T: Instance, Tx, Rx> FMAC<'d, T, Tx, Rx> {
pub fn new(peri: impl Peripheral<P = T> + 'd) -> Self {
unimplemented!()
}
}
pub(crate) mod sealed {
use super::*;
pub trait Instance {
const REGS: Regs;
}
}
pub trait Instance: Peripheral<P = Self> + sealed::Instance {}
foreach_peripheral!(
(fmac, $inst:ident) => {
impl sealed::Instance for peripherals::$inst {
const REGS: Regs = crate::pac::$inst;
}
impl Instance for peripherals::$inst {}
};
);

View File

@ -36,6 +36,8 @@ pub mod dcmi;
pub mod eth; pub mod eth;
#[cfg(feature = "exti")] #[cfg(feature = "exti")]
pub mod exti; pub mod exti;
#[cfg(any(rcc_h5))]
pub mod fmac;
#[cfg(fmc)] #[cfg(fmc)]
pub mod fmc; pub mod fmc;
#[cfg(i2c)] #[cfg(i2c)]