diff options
| author | Corey Schuhen <[email protected]> | 2024-02-24 18:31:05 +1000 |
|---|---|---|
| committer | Corey Schuhen <[email protected]> | 2024-02-25 10:13:58 +1000 |
| commit | 2d634d07e08650caf2c2940343a1a63e0bc66f05 (patch) | |
| tree | e79b96b8c8a76075acdb3cd925c07c5af626e4db | |
| parent | 4657c105473122017a2df0fec6449ffb401927f4 (diff) | |
FDCAN: Remove extra traits from.
Comments
Fix.
| -rw-r--r-- | embassy-stm32/src/can/fdcan.rs | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/embassy-stm32/src/can/fdcan.rs b/embassy-stm32/src/can/fdcan.rs index f1f6f935e..fc5d47ab7 100644 --- a/embassy-stm32/src/can/fdcan.rs +++ b/embassy-stm32/src/can/fdcan.rs | |||
| @@ -861,22 +861,13 @@ pub(crate) mod sealed { | |||
| 861 | } | 861 | } |
| 862 | } | 862 | } |
| 863 | 863 | ||
| 864 | /// Trait for FDCAN interrupt channel 0 | 864 | /// Instance trait |
| 865 | pub trait IT0Instance { | 865 | pub trait Instance: sealed::Instance + RccPeripheral + 'static { |
| 866 | /// Type for FDCAN interrupt channel 0 | 866 | /// Interrupt 0 |
| 867 | type IT0Interrupt: crate::interrupt::typelevel::Interrupt; | 867 | type IT0Interrupt: crate::interrupt::typelevel::Interrupt; |
| 868 | } | 868 | /// Interrupt 0 |
| 869 | |||
| 870 | /// Trait for FDCAN interrupt channel 1 | ||
| 871 | pub trait IT1Instance { | ||
| 872 | /// Type for FDCAN interrupt channel 1 | ||
| 873 | type IT1Interrupt: crate::interrupt::typelevel::Interrupt; | 869 | type IT1Interrupt: crate::interrupt::typelevel::Interrupt; |
| 874 | } | 870 | } |
| 875 | |||
| 876 | /// InterruptableInstance trait | ||
| 877 | pub trait InterruptableInstance: IT0Instance + IT1Instance {} | ||
| 878 | /// Instance trait | ||
| 879 | pub trait Instance: sealed::Instance + RccPeripheral + InterruptableInstance + 'static {} | ||
| 880 | /// Fdcan Instance struct | 871 | /// Fdcan Instance struct |
| 881 | pub struct FdcanInstance<'a, T>(PeripheralRef<'a, T>); | 872 | pub struct FdcanInstance<'a, T>(PeripheralRef<'a, T>); |
| 882 | 873 | ||
| @@ -921,22 +912,22 @@ fn calc_timestamp(_ns_per_timer_tick: u64, ts_val: u16) -> Timestamp { | |||
| 921 | 912 | ||
| 922 | } | 913 | } |
| 923 | 914 | ||
| 924 | impl Instance for peripherals::$inst {} | 915 | #[allow(non_snake_case)] |
| 925 | 916 | pub(crate) mod $inst { | |
| 926 | foreach_interrupt!( | 917 | |
| 927 | ($inst,can,FDCAN,IT0,$irq:ident) => { | 918 | foreach_interrupt!( |
| 928 | impl IT0Instance for peripherals::$inst { | 919 | ($inst,can,FDCAN,IT0,$irq:ident) => { |
| 929 | type IT0Interrupt = crate::interrupt::typelevel::$irq; | 920 | pub type Interrupt0 = crate::interrupt::typelevel::$irq; |
| 930 | } | 921 | }; |
| 931 | }; | 922 | ($inst,can,FDCAN,IT1,$irq:ident) => { |
| 932 | ($inst,can,FDCAN,IT1,$irq:ident) => { | 923 | pub type Interrupt1 = crate::interrupt::typelevel::$irq; |
| 933 | impl IT1Instance for peripherals::$inst { | 924 | }; |
| 934 | type IT1Interrupt = crate::interrupt::typelevel::$irq; | 925 | ); |
| 935 | } | 926 | } |
| 936 | }; | 927 | impl Instance for peripherals::$inst { |
| 937 | ); | 928 | type IT0Interrupt = $inst::Interrupt0; |
| 938 | 929 | type IT1Interrupt = $inst::Interrupt1; | |
| 939 | impl InterruptableInstance for peripherals::$inst {} | 930 | } |
| 940 | }; | 931 | }; |
| 941 | 932 | ||
| 942 | ($inst:ident, $msg_ram_inst:ident) => { | 933 | ($inst:ident, $msg_ram_inst:ident) => { |
