embassy_stm32_plus/traits/can/
can1.rs1use embassy_stm32::can::Can;
2#[cfg(CAN)]
3use embassy_stm32::peripherals::CAN;
4#[cfg(CAN1)]
5use embassy_stm32::peripherals::CAN1;
6use crate::builder::can::can1::{Can1Builder, Can1Rx, Can1Tx};
7
8pub trait Can1Trait {
10 fn build(self, tx: Can1Tx, rx: Can1Rx) -> Can<'static>;
12}
13
14macro_rules! impl_can1_trait {
16 ($can:ty) => {
17 impl Can1Trait for $can {
18 #[inline]
19 fn build(self, tx: Can1Tx, rx: Can1Rx) -> Can<'static> {
20 Can1Builder::new(self, tx, rx).build()
21 }
22 }
23 };
24}
25
26#[cfg(CAN)]
27impl_can1_trait!(CAN);
28#[cfg(CAN1)]
29impl_can1_trait!(CAN1);