summaryrefslogtreecommitdiff
path: root/embassy-nrf
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2022-09-26 12:29:27 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2022-09-26 12:29:27 +0200
commit7f7c14b7bce5b84eb27c8122535a96a6f0e5dd77 (patch)
treec7481fd07b616128718301de7aafea553cc8dd6f /embassy-nrf
parenta9efbf18c62186de0581ec72cca90a69340a02a3 (diff)
downloadembassy-7f7c14b7bce5b84eb27c8122535a96a6f0e5dd77.zip
usb: split driver trait to separate crate.
Diffstat (limited to 'embassy-nrf')
-rw-r--r--embassy-nrf/src/usb.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs
index 0685d419..20510eb4 100644
--- a/embassy-nrf/src/usb.rs
+++ b/embassy-nrf/src/usb.rs
@@ -10,8 +10,9 @@ use cortex_m::peripheral::NVIC;
use embassy_hal_common::{into_ref, PeripheralRef};
use embassy_sync::waitqueue::AtomicWaker;
pub use embassy_usb;
-use embassy_usb::driver::{self, EndpointError, Event, Unsupported};
-use embassy_usb::types::{EndpointAddress, EndpointInfo, EndpointType, UsbDirection};
+use embassy_usb::driver::{
+ self, Direction, EndpointAddress, EndpointError, EndpointInfo, EndpointType, Event, Unsupported,
+};
use pac::usbd::RegisterBlock;
use crate::interrupt::{Interrupt, InterruptExt};
@@ -243,7 +244,7 @@ impl<'d, T: Instance, P: UsbSupply + 'd> driver::Driver<'d> for Driver<'d, T, P>
interval: u8,
) -> Result<Self::EndpointIn, driver::EndpointAllocError> {
let index = self.alloc_in.allocate(ep_type)?;
- let ep_addr = EndpointAddress::from_parts(index, UsbDirection::In);
+ let ep_addr = EndpointAddress::from_parts(index, Direction::In);
Ok(Endpoint::new(EndpointInfo {
addr: ep_addr,
ep_type,
@@ -259,7 +260,7 @@ impl<'d, T: Instance, P: UsbSupply + 'd> driver::Driver<'d> for Driver<'d, T, P>
interval: u8,
) -> Result<Self::EndpointOut, driver::EndpointAllocError> {
let index = self.alloc_out.allocate(ep_type)?;
- let ep_addr = EndpointAddress::from_parts(index, UsbDirection::Out);
+ let ep_addr = EndpointAddress::from_parts(index, Direction::Out);
Ok(Endpoint::new(EndpointInfo {
addr: ep_addr,
ep_type,
@@ -428,8 +429,8 @@ impl<'d, T: Instance, P: UsbSupply> driver::Bus for Bus<'d, T, P> {
let regs = T::regs();
let i = ep_addr.index();
match ep_addr.direction() {
- UsbDirection::Out => regs.halted.epout[i].read().getstatus().is_halted(),
- UsbDirection::In => regs.halted.epin[i].read().getstatus().is_halted(),
+ Direction::Out => regs.halted.epout[i].read().getstatus().is_halted(),
+ Direction::In => regs.halted.epin[i].read().getstatus().is_halted(),
}
}
@@ -442,7 +443,7 @@ impl<'d, T: Instance, P: UsbSupply> driver::Bus for Bus<'d, T, P> {
debug!("endpoint_set_enabled {:?} {}", ep_addr, enabled);
match ep_addr.direction() {
- UsbDirection::In => {
+ Direction::In => {
let mut was_enabled = false;
regs.epinen.modify(|r, w| {
let mut bits = r.bits();
@@ -466,7 +467,7 @@ impl<'d, T: Instance, P: UsbSupply> driver::Bus for Bus<'d, T, P> {
In::waker(i).wake();
}
- UsbDirection::Out => {
+ Direction::Out => {
regs.epouten.modify(|r, w| {
let mut bits = r.bits();
if enabled {