From 2e104170de36295243608fbbebebdc6f52e8f8d0 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 9 May 2022 02:07:48 +0200 Subject: usb: remove address arg from endpoint allocation. --- embassy-usb/src/driver.rs | 2 -- 1 file changed, 2 deletions(-) (limited to 'embassy-usb/src/driver.rs') diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs index e552dc7b6..a782b377c 100644 --- a/embassy-usb/src/driver.rs +++ b/embassy-usb/src/driver.rs @@ -25,7 +25,6 @@ pub trait Driver<'a> { /// * `interval` - Polling interval parameter for interrupt endpoints. fn alloc_endpoint_out( &mut self, - ep_addr: Option, ep_type: EndpointType, max_packet_size: u16, interval: u8, @@ -33,7 +32,6 @@ pub trait Driver<'a> { fn alloc_endpoint_in( &mut self, - ep_addr: Option, ep_type: EndpointType, max_packet_size: u16, interval: u8, -- cgit From 6af5f8eb2da6ba9e1eabb67871c3483ba1579dd2 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 10 May 2022 16:53:42 +0200 Subject: usb: merge `alloc_control_pipe` and `into_bus` into `start`. This prevents calling `alloc_control_pipe` twice at compile time, which was always an error. --- embassy-usb/src/driver.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'embassy-usb/src/driver.rs') diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs index a782b377c..57f2b0656 100644 --- a/embassy-usb/src/driver.rs +++ b/embassy-usb/src/driver.rs @@ -14,7 +14,7 @@ pub trait Driver<'a> { /// Allocates an endpoint and specified endpoint parameters. This method is called by the device /// and class implementations to allocate endpoints, and can only be called before - /// [`enable`](UsbBus::enable) is called. + /// [`start`](UsbBus::start) is called. /// /// # Arguments /// @@ -37,14 +37,15 @@ pub trait Driver<'a> { interval: u8, ) -> Result; - fn alloc_control_pipe( - &mut self, - max_packet_size: u16, - ) -> Result; - - /// Enables and initializes the USB peripheral. Soon after enabling the device will be reset, so - /// there is no need to perform a USB reset in this method. - fn into_bus(self) -> Self::Bus; + /// Start operation of the USB device. + /// + /// This returns the `Bus` and `ControlPipe` instances that are used to operate + /// the USB device. Additionally, this makes all the previously allocated endpoints + /// start operating. + /// + /// This consumes the `Driver` instance, so it's no longer possible to allocate more + /// endpoints. + fn start(self, control_max_packet_size: u16) -> (Self::Bus, Self::ControlPipe); /// Indicates that `set_device_address` must be called before accepting the corresponding /// control transfer, not after. -- cgit