diff options
| -rw-r--r-- | embassy-nrf/src/usb.rs | 13 | ||||
| -rw-r--r-- | embassy-usb/src/driver.rs | 4 | ||||
| -rw-r--r-- | embassy-usb/src/lib.rs | 4 |
3 files changed, 8 insertions, 13 deletions
diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index 1162946a9..9dedc471e 100644 --- a/embassy-nrf/src/usb.rs +++ b/embassy-nrf/src/usb.rs | |||
| @@ -9,7 +9,6 @@ use embassy::interrupt::InterruptExt; | |||
| 9 | use embassy::util::Unborrow; | 9 | use embassy::util::Unborrow; |
| 10 | use embassy::waitqueue::AtomicWaker; | 10 | use embassy::waitqueue::AtomicWaker; |
| 11 | use embassy_hal_common::unborrow; | 11 | use embassy_hal_common::unborrow; |
| 12 | use embassy_usb::control::Request; | ||
| 13 | use embassy_usb::driver::{self, EndpointError, Event, Unsupported}; | 12 | use embassy_usb::driver::{self, EndpointError, Event, Unsupported}; |
| 14 | use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; | 13 | use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection}; |
| 15 | use futures::future::poll_fn; | 14 | use futures::future::poll_fn; |
| @@ -682,14 +681,7 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { | |||
| 682 | buf[6] = regs.wlengthl.read().wlengthl().bits(); | 681 | buf[6] = regs.wlengthl.read().wlengthl().bits(); |
| 683 | buf[7] = regs.wlengthh.read().wlengthh().bits(); | 682 | buf[7] = regs.wlengthh.read().wlengthh().bits(); |
| 684 | 683 | ||
| 685 | let req = Request::parse(&buf); | 684 | buf |
| 686 | |||
| 687 | if req.direction == UsbDirection::Out { | ||
| 688 | regs.tasks_ep0rcvout | ||
| 689 | .write(|w| w.tasks_ep0rcvout().set_bit()); | ||
| 690 | } | ||
| 691 | |||
| 692 | req | ||
| 693 | } | 685 | } |
| 694 | } | 686 | } |
| 695 | 687 | ||
| @@ -697,6 +689,9 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> { | |||
| 697 | async move { | 689 | async move { |
| 698 | let regs = T::regs(); | 690 | let regs = T::regs(); |
| 699 | 691 | ||
| 692 | regs.tasks_ep0rcvout | ||
| 693 | .write(|w| w.tasks_ep0rcvout().set_bit()); | ||
| 694 | |||
| 700 | // Wait until ready | 695 | // Wait until ready |
| 701 | regs.intenset.write(|w| { | 696 | regs.intenset.write(|w| { |
| 702 | w.usbreset().set(); | 697 | w.usbreset().set(); |
diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs index 57f2b0656..8454b041f 100644 --- a/embassy-usb/src/driver.rs +++ b/embassy-usb/src/driver.rs | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | use core::future::Future; | 1 | use core::future::Future; |
| 2 | 2 | ||
| 3 | use crate::control::Request; | ||
| 4 | |||
| 5 | use super::types::*; | 3 | use super::types::*; |
| 6 | 4 | ||
| 7 | /// Driver for a specific USB peripheral. Implement this to add support for a new hardware | 5 | /// Driver for a specific USB peripheral. Implement this to add support for a new hardware |
| @@ -146,7 +144,7 @@ pub trait EndpointOut: Endpoint { | |||
| 146 | } | 144 | } |
| 147 | 145 | ||
| 148 | pub trait ControlPipe { | 146 | pub trait ControlPipe { |
| 149 | type SetupFuture<'a>: Future<Output = Request> + 'a | 147 | type SetupFuture<'a>: Future<Output = [u8; 8]> + 'a |
| 150 | where | 148 | where |
| 151 | Self: 'a; | 149 | Self: 'a; |
| 152 | type DataOutFuture<'a>: Future<Output = Result<usize, EndpointError>> + 'a | 150 | type DataOutFuture<'a>: Future<Output = Result<usize, EndpointError>> + 'a |
diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs index b135f5eb3..7b85a2884 100644 --- a/embassy-usb/src/lib.rs +++ b/embassy-usb/src/lib.rs | |||
| @@ -246,7 +246,9 @@ impl<'d, D: Driver<'d>> UsbDevice<'d, D> { | |||
| 246 | } | 246 | } |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | async fn handle_control(&mut self, req: Request) { | 249 | async fn handle_control(&mut self, req: [u8; 8]) { |
| 250 | let req = Request::parse(&req); | ||
| 251 | |||
| 250 | trace!("control request: {:02x}", req); | 252 | trace!("control request: {:02x}", req); |
| 251 | 253 | ||
| 252 | match req.direction { | 254 | match req.direction { |
