[UCPD] Instance and Pin Traits
Skip FRSTX pin for now. Its available twice in the device JSON as FRSTX1 and FRSTX2 both with the same pins as targets. I don’t know enough about the FRS (fast role switch) feature to understand if that is correct and how to handle the pins.
This commit is contained in:
parent
1ef02e5384
commit
8a255b375b
3 changed files with 34 additions and 0 deletions
|
@ -764,6 +764,8 @@ fn main() {
|
|||
#[rustfmt::skip]
|
||||
let signals: HashMap<_, _> = [
|
||||
// (kind, signal) => trait
|
||||
(("ucpd", "CC1"), quote!(crate::ucpd::Cc1Pin)),
|
||||
(("ucpd", "CC2"), quote!(crate::ucpd::Cc2Pin)),
|
||||
(("usart", "TX"), quote!(crate::usart::TxPin)),
|
||||
(("usart", "RX"), quote!(crate::usart::RxPin)),
|
||||
(("usart", "CTS"), quote!(crate::usart::CtsPin)),
|
||||
|
@ -1102,6 +1104,8 @@ fn main() {
|
|||
|
||||
let signals: HashMap<_, _> = [
|
||||
// (kind, signal) => trait
|
||||
(("ucpd", "RX"), quote!(crate::ucpd::RxDma)),
|
||||
(("ucpd", "TX"), quote!(crate::ucpd::TxDma)),
|
||||
(("usart", "RX"), quote!(crate::usart::RxDma)),
|
||||
(("usart", "TX"), quote!(crate::usart::TxDma)),
|
||||
(("lpuart", "RX"), quote!(crate::usart::RxDma)),
|
||||
|
|
|
@ -73,6 +73,8 @@ pub mod sai;
|
|||
pub mod sdmmc;
|
||||
#[cfg(spi)]
|
||||
pub mod spi;
|
||||
#[cfg(ucpd)]
|
||||
pub mod ucpd;
|
||||
#[cfg(uid)]
|
||||
pub mod uid;
|
||||
#[cfg(usart)]
|
||||
|
|
28
embassy-stm32/src/ucpd.rs
Normal file
28
embassy-stm32/src/ucpd.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
//! USB Type-C/USB Power Delivery Interface (UCPD)
|
||||
|
||||
use crate::rcc::RccPeripheral;
|
||||
|
||||
/// UCPD instance trait.
|
||||
pub trait Instance: sealed::Instance + RccPeripheral {}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
pub trait Instance {
|
||||
const REGS: crate::pac::ucpd::Ucpd;
|
||||
}
|
||||
}
|
||||
|
||||
foreach_peripheral!(
|
||||
(ucpd, $inst:ident) => {
|
||||
impl sealed::Instance for crate::peripherals::$inst {
|
||||
const REGS: crate::pac::ucpd::Ucpd = crate::pac::$inst;
|
||||
}
|
||||
|
||||
impl Instance for crate::peripherals::$inst {}
|
||||
};
|
||||
);
|
||||
|
||||
pin_trait!(Cc1Pin, Instance);
|
||||
pin_trait!(Cc2Pin, Instance);
|
||||
|
||||
dma_trait!(TxDma, Instance);
|
||||
dma_trait!(RxDma, Instance);
|
Loading…
Add table
Reference in a new issue