From be06c5716cbd7a2973dfac8a65d89b94406e490d Mon Sep 17 00:00:00 2001 From: Scott Mabin Date: Thu, 18 Apr 2024 00:44:01 +0100 Subject: [PATCH] Remove uneeded usb generics --- esp-hal/src/otg_fs.rs | 47 +++++++++++++------------------------------ 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/esp-hal/src/otg_fs.rs b/esp-hal/src/otg_fs.rs index 41d6027c42d..69a96a91582 100644 --- a/esp-hal/src/otg_fs.rs +++ b/esp-hal/src/otg_fs.rs @@ -37,55 +37,36 @@ use crate::{ }; #[doc(hidden)] -pub trait UsbDp {} +pub trait UsbDp: crate::private::Sealed {} #[doc(hidden)] -pub trait UsbDm {} +pub trait UsbDm: crate::private::Sealed {} -pub struct USB<'d, P, M> -where - P: UsbDp + Send + Sync, - M: UsbDm + Send + Sync, -{ +pub struct USB<'d> { _usb0: PeripheralRef<'d, peripherals::USB0>, - _usb_dp: PeripheralRef<'d, P>, - _usb_dm: PeripheralRef<'d, M>, } -impl<'d, P, M> USB<'d, P, M> -where - P: UsbDp + Send + Sync, - M: UsbDm + Send + Sync, -{ - pub fn new( +impl<'d> USB<'d> { + pub fn new( usb0: impl Peripheral

+ 'd, - usb_dp: impl Peripheral

+ 'd, - usb_dm: impl Peripheral

+ 'd, - ) -> Self { - crate::into_ref!(usb_dp, usb_dm); - + _usb_dp: impl Peripheral

+ 'd, + _usb_dm: impl Peripheral

+ 'd, + ) -> Self + where + P: UsbDp + Send + Sync, + M: UsbDm + Send + Sync, + { PeripheralClockControl::enable(PeripheralEnable::Usb); Self { _usb0: usb0.into_ref(), - _usb_dp: usb_dp, - _usb_dm: usb_dm, } } } -unsafe impl<'d, P, M> Sync for USB<'d, P, M> -where - P: UsbDp + Send + Sync, - M: UsbDm + Send + Sync, -{ -} +unsafe impl<'d> Sync for USB<'d> {} -unsafe impl<'d, P, M> UsbPeripheral for USB<'d, P, M> -where - P: UsbDp + Send + Sync, - M: UsbDm + Send + Sync, -{ +unsafe impl<'d> UsbPeripheral for USB<'d> { const REGISTERS: *const () = peripherals::USB0::ptr() as *const (); const HIGH_SPEED: bool = false;