summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2022-09-26 13:00:21 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2022-09-26 13:00:21 +0200
commitf27a47a37b59bf3b9079f4d4d5f43caf7b7872f8 (patch)
tree732f73b4da7a2e726203f2876651a2141d9468be
parentf4f58249722bc656a13865e06535d208440c3e4a (diff)
downloadembassy-f27a47a37b59bf3b9079f4d4d5f43caf7b7872f8.zip
usb: move classes into the `embassy-usb` crate.
-rw-r--r--embassy-usb-hid/Cargo.toml24
-rw-r--r--embassy-usb-hid/src/fmt.rs225
-rw-r--r--embassy-usb-ncm/Cargo.toml17
-rw-r--r--embassy-usb-ncm/src/fmt.rs225
-rw-r--r--embassy-usb-serial/Cargo.toml17
-rw-r--r--embassy-usb-serial/src/fmt.rs225
-rw-r--r--embassy-usb/Cargo.toml9
-rw-r--r--embassy-usb/src/class/cdc_acm.rs (renamed from embassy-usb-serial/src/lib.rs)15
-rw-r--r--embassy-usb/src/class/cdc_ncm.rs (renamed from embassy-usb-ncm/src/lib.rs)13
-rw-r--r--embassy-usb/src/class/hid.rs (renamed from embassy-usb-hid/src/lib.rs)23
-rw-r--r--embassy-usb/src/class/mod.rs3
-rw-r--r--embassy-usb/src/lib.rs1
-rw-r--r--examples/nrf/Cargo.toml5
-rw-r--r--examples/nrf/src/bin/usb_ethernet.rs2
-rw-r--r--examples/nrf/src/bin/usb_hid_keyboard.rs4
-rw-r--r--examples/nrf/src/bin/usb_hid_mouse.rs4
-rw-r--r--examples/nrf/src/bin/usb_serial.rs2
-rw-r--r--examples/nrf/src/bin/usb_serial_multitask.rs2
-rw-r--r--examples/rp/Cargo.toml2
-rw-r--r--examples/rp/src/bin/usb_ethernet.rs2
-rw-r--r--examples/rp/src/bin/usb_serial.rs2
-rw-r--r--examples/stm32f1/Cargo.toml1
-rw-r--r--examples/stm32f1/src/bin/usb_serial.rs2
-rw-r--r--examples/stm32f3/Cargo.toml2
-rw-r--r--examples/stm32f3/src/bin/usb_serial.rs2
-rw-r--r--examples/stm32l5/Cargo.toml3
-rw-r--r--examples/stm32l5/src/bin/usb_ethernet.rs2
-rw-r--r--examples/stm32l5/src/bin/usb_hid_mouse.rs4
-rw-r--r--examples/stm32l5/src/bin/usb_serial.rs2
29 files changed, 45 insertions, 795 deletions
diff --git a/embassy-usb-hid/Cargo.toml b/embassy-usb-hid/Cargo.toml
deleted file mode 100644
index 2f7733dc..00000000
--- a/embassy-usb-hid/Cargo.toml
+++ /dev/null
@@ -1,24 +0,0 @@
-[package]
-name = "embassy-usb-hid"
-version = "0.1.0"
-edition = "2021"
-
-[package.metadata.embassy_docs]
-src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-hid-v$VERSION/embassy-usb-hid/src/"
-src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb-hid/src/"
-features = ["defmt"]
-target = "thumbv7em-none-eabi"
-
-[features]
-default = ["usbd-hid"]
-usbd-hid = ["dep:usbd-hid", "ssmarshal"]
-
-[dependencies]
-embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
-embassy-usb = { version = "0.1.0", path = "../embassy-usb" }
-
-defmt = { version = "0.3", optional = true }
-log = { version = "0.4.14", optional = true }
-usbd-hid = { version = "0.6.0", optional = true }
-ssmarshal = { version = "1.0", default-features = false, optional = true }
-futures-util = { version = "0.3.21", default-features = false }
diff --git a/embassy-usb-hid/src/fmt.rs b/embassy-usb-hid/src/fmt.rs
deleted file mode 100644
index 06697081..00000000
--- a/embassy-usb-hid/src/fmt.rs
+++ /dev/null
@@ -1,225 +0,0 @@
-#![macro_use]
-#![allow(unused_macros)]
-
-#[cfg(all(feature = "defmt", feature = "log"))]
-compile_error!("You may not enable both `defmt` and `log` features.");
-
-macro_rules! assert {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert!($($x)*);
- }
- };
-}
-
-macro_rules! assert_eq {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert_eq!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert_eq!($($x)*);
- }
- };
-}
-
-macro_rules! assert_ne {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert_ne!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert_ne!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert_eq {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert_eq!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert_eq!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert_ne {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert_ne!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert_ne!($($x)*);
- }
- };
-}
-
-macro_rules! todo {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::todo!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::todo!($($x)*);
- }
- };
-}
-
-macro_rules! unreachable {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::unreachable!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::unreachable!($($x)*);
- }
- };
-}
-
-macro_rules! panic {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::panic!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::panic!($($x)*);
- }
- };
-}
-
-macro_rules! trace {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::trace!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::trace!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! debug {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::debug!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! info {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::info!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::info!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! warn {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::warn!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::warn!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! error {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::error!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::error!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-#[cfg(feature = "defmt")]
-macro_rules! unwrap {
- ($($x:tt)*) => {
- ::defmt::unwrap!($($x)*)
- };
-}
-
-#[cfg(not(feature = "defmt"))]
-macro_rules! unwrap {
- ($arg:expr) => {
- match $crate::fmt::Try::into_result($arg) {
- ::core::result::Result::Ok(t) => t,
- ::core::result::Result::Err(e) => {
- ::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e);
- }
- }
- };
- ($arg:expr, $($msg:expr),+ $(,)? ) => {
- match $crate::fmt::Try::into_result($arg) {
- ::core::result::Result::Ok(t) => t,
- ::core::result::Result::Err(e) => {
- ::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e);
- }
- }
- }
-}
-
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub struct NoneError;
-
-pub trait Try {
- type Ok;
- type Error;
- fn into_result(self) -> Result<Self::Ok, Self::Error>;
-}
-
-impl<T> Try for Option<T> {
- type Ok = T;
- type Error = NoneError;
-
- #[inline]
- fn into_result(self) -> Result<T, NoneError> {
- self.ok_or(NoneError)
- }
-}
-
-impl<T, E> Try for Result<T, E> {
- type Ok = T;
- type Error = E;
-
- #[inline]
- fn into_result(self) -> Self {
- self
- }
-}
diff --git a/embassy-usb-ncm/Cargo.toml b/embassy-usb-ncm/Cargo.toml
deleted file mode 100644
index 15d3db96..00000000
--- a/embassy-usb-ncm/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-name = "embassy-usb-ncm"
-version = "0.1.0"
-edition = "2021"
-
-[package.metadata.embassy_docs]
-src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-ncm-v$VERSION/embassy-usb-ncm/src/"
-src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb-ncm/src/"
-features = ["defmt"]
-target = "thumbv7em-none-eabi"
-
-[dependencies]
-embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
-embassy-usb = { version = "0.1.0", path = "../embassy-usb" }
-
-defmt = { version = "0.3", optional = true }
-log = { version = "0.4.14", optional = true }
diff --git a/embassy-usb-ncm/src/fmt.rs b/embassy-usb-ncm/src/fmt.rs
deleted file mode 100644
index 06697081..00000000
--- a/embassy-usb-ncm/src/fmt.rs
+++ /dev/null
@@ -1,225 +0,0 @@
-#![macro_use]
-#![allow(unused_macros)]
-
-#[cfg(all(feature = "defmt", feature = "log"))]
-compile_error!("You may not enable both `defmt` and `log` features.");
-
-macro_rules! assert {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert!($($x)*);
- }
- };
-}
-
-macro_rules! assert_eq {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert_eq!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert_eq!($($x)*);
- }
- };
-}
-
-macro_rules! assert_ne {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert_ne!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert_ne!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert_eq {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert_eq!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert_eq!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert_ne {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert_ne!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert_ne!($($x)*);
- }
- };
-}
-
-macro_rules! todo {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::todo!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::todo!($($x)*);
- }
- };
-}
-
-macro_rules! unreachable {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::unreachable!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::unreachable!($($x)*);
- }
- };
-}
-
-macro_rules! panic {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::panic!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::panic!($($x)*);
- }
- };
-}
-
-macro_rules! trace {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::trace!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::trace!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! debug {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::debug!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! info {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::info!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::info!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! warn {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::warn!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::warn!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! error {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::error!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::error!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-#[cfg(feature = "defmt")]
-macro_rules! unwrap {
- ($($x:tt)*) => {
- ::defmt::unwrap!($($x)*)
- };
-}
-
-#[cfg(not(feature = "defmt"))]
-macro_rules! unwrap {
- ($arg:expr) => {
- match $crate::fmt::Try::into_result($arg) {
- ::core::result::Result::Ok(t) => t,
- ::core::result::Result::Err(e) => {
- ::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e);
- }
- }
- };
- ($arg:expr, $($msg:expr),+ $(,)? ) => {
- match $crate::fmt::Try::into_result($arg) {
- ::core::result::Result::Ok(t) => t,
- ::core::result::Result::Err(e) => {
- ::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e);
- }
- }
- }
-}
-
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub struct NoneError;
-
-pub trait Try {
- type Ok;
- type Error;
- fn into_result(self) -> Result<Self::Ok, Self::Error>;
-}
-
-impl<T> Try for Option<T> {
- type Ok = T;
- type Error = NoneError;
-
- #[inline]
- fn into_result(self) -> Result<T, NoneError> {
- self.ok_or(NoneError)
- }
-}
-
-impl<T, E> Try for Result<T, E> {
- type Ok = T;
- type Error = E;
-
- #[inline]
- fn into_result(self) -> Self {
- self
- }
-}
diff --git a/embassy-usb-serial/Cargo.toml b/embassy-usb-serial/Cargo.toml
deleted file mode 100644
index 9788588e..00000000
--- a/embassy-usb-serial/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-name = "embassy-usb-serial"
-version = "0.1.0"
-edition = "2021"
-
-[package.metadata.embassy_docs]
-src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-serial-v$VERSION/embassy-usb-serial/src/"
-src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb-serial/src/"
-features = ["defmt"]
-target = "thumbv7em-none-eabi"
-
-[dependencies]
-embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
-embassy-usb = { version = "0.1.0", path = "../embassy-usb" }
-
-defmt = { version = "0.3", optional = true }
-log = { version = "0.4.14", optional = true }
diff --git a/embassy-usb-serial/src/fmt.rs b/embassy-usb-serial/src/fmt.rs
deleted file mode 100644
index 06697081..00000000
--- a/embassy-usb-serial/src/fmt.rs
+++ /dev/null
@@ -1,225 +0,0 @@
-#![macro_use]
-#![allow(unused_macros)]
-
-#[cfg(all(feature = "defmt", feature = "log"))]
-compile_error!("You may not enable both `defmt` and `log` features.");
-
-macro_rules! assert {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert!($($x)*);
- }
- };
-}
-
-macro_rules! assert_eq {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert_eq!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert_eq!($($x)*);
- }
- };
-}
-
-macro_rules! assert_ne {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::assert_ne!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::assert_ne!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert_eq {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert_eq!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert_eq!($($x)*);
- }
- };
-}
-
-macro_rules! debug_assert_ne {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::debug_assert_ne!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug_assert_ne!($($x)*);
- }
- };
-}
-
-macro_rules! todo {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::todo!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::todo!($($x)*);
- }
- };
-}
-
-macro_rules! unreachable {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::unreachable!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::unreachable!($($x)*);
- }
- };
-}
-
-macro_rules! panic {
- ($($x:tt)*) => {
- {
- #[cfg(not(feature = "defmt"))]
- ::core::panic!($($x)*);
- #[cfg(feature = "defmt")]
- ::defmt::panic!($($x)*);
- }
- };
-}
-
-macro_rules! trace {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::trace!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::trace!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! debug {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::debug!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::debug!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! info {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::info!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::info!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! warn {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::warn!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::warn!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-macro_rules! error {
- ($s:literal $(, $x:expr)* $(,)?) => {
- {
- #[cfg(feature = "log")]
- ::log::error!($s $(, $x)*);
- #[cfg(feature = "defmt")]
- ::defmt::error!($s $(, $x)*);
- #[cfg(not(any(feature = "log", feature="defmt")))]
- let _ = ($( & $x ),*);
- }
- };
-}
-
-#[cfg(feature = "defmt")]
-macro_rules! unwrap {
- ($($x:tt)*) => {
- ::defmt::unwrap!($($x)*)
- };
-}
-
-#[cfg(not(feature = "defmt"))]
-macro_rules! unwrap {
- ($arg:expr) => {
- match $crate::fmt::Try::into_result($arg) {
- ::core::result::Result::Ok(t) => t,
- ::core::result::Result::Err(e) => {
- ::core::panic!("unwrap of `{}` failed: {:?}", ::core::stringify!($arg), e);
- }
- }
- };
- ($arg:expr, $($msg:expr),+ $(,)? ) => {
- match $crate::fmt::Try::into_result($arg) {
- ::core::result::Result::Ok(t) => t,
- ::core::result::Result::Err(e) => {
- ::core::panic!("unwrap of `{}` failed: {}: {:?}", ::core::stringify!($arg), ::core::format_args!($($msg,)*), e);
- }
- }
- }
-}
-
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub struct NoneError;
-
-pub trait Try {
- type Ok;
- type Error;
- fn into_result(self) -> Result<Self::Ok, Self::Error>;
-}
-
-impl<T> Try for Option<T> {
- type Ok = T;
- type Error = NoneError;
-
- #[inline]
- fn into_result(self) -> Result<T, NoneError> {
- self.ok_or(NoneError)
- }
-}
-
-impl<T, E> Try for Result<T, E> {
- type Ok = T;
- type Error = E;
-
- #[inline]
- fn into_result(self) -> Self {
- self
- }
-}
diff --git a/embassy-usb/Cargo.toml b/embassy-usb/Cargo.toml
index 660ecc8c..aad54dba 100644
--- a/embassy-usb/Cargo.toml
+++ b/embassy-usb/Cargo.toml
@@ -11,11 +11,18 @@ target = "thumbv7em-none-eabi"
[features]
defmt = ["dep:defmt", "embassy-usb-driver/defmt"]
+usbd-hid = ["dep:usbd-hid", "dep:ssmarshal"]
+default = ["usbd-hid"]
[dependencies]
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
embassy-usb-driver = { version = "0.1.0", path = "../embassy-usb-driver" }
+embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
-heapless = "0.7.10" \ No newline at end of file
+heapless = "0.7.10"
+
+# for HID
+usbd-hid = { version = "0.6.0", optional = true }
+ssmarshal = { version = "1.0", default-features = false, optional = true }
diff --git a/embassy-usb-serial/src/lib.rs b/embassy-usb/src/class/cdc_acm.rs
index 15c2bb0a..09bb1cc8 100644
--- a/embassy-usb-serial/src/lib.rs
+++ b/embassy-usb/src/class/cdc_acm.rs
@@ -1,18 +1,13 @@
-#![no_std]
-#![feature(type_alias_impl_trait)]
-
-// This mod MUST go first, so that the others see its macros.
-pub(crate) mod fmt;
-
use core::cell::Cell;
use core::mem::{self, MaybeUninit};
use core::sync::atomic::{AtomicBool, Ordering};
use embassy_sync::blocking_mutex::CriticalSectionMutex;
-use embassy_usb::control::{self, ControlHandler, InResponse, OutResponse, Request};
-use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
-use embassy_usb::types::*;
-use embassy_usb::Builder;
+
+use crate::control::{self, ControlHandler, InResponse, OutResponse, Request};
+use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
+use crate::types::*;
+use crate::Builder;
/// This should be used as `device_class` when building the `UsbDevice`.
pub const USB_CLASS_CDC: u8 = 0x02;
diff --git a/embassy-usb-ncm/src/lib.rs b/embassy-usb/src/class/cdc_ncm.rs
index e796af28..a39b87e9 100644
--- a/embassy-usb-ncm/src/lib.rs
+++ b/embassy-usb/src/class/cdc_ncm.rs
@@ -1,15 +1,10 @@
-#![no_std]
-
-// This mod MUST go first, so that the others see its macros.
-pub(crate) mod fmt;
-
use core::intrinsics::copy_nonoverlapping;
use core::mem::{size_of, MaybeUninit};
-use embassy_usb::control::{self, ControlHandler, InResponse, OutResponse, Request};
-use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
-use embassy_usb::types::*;
-use embassy_usb::Builder;
+use crate::control::{self, ControlHandler, InResponse, OutResponse, Request};
+use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
+use crate::types::*;
+use crate::Builder;
/// This should be used as `device_class` when building the `UsbDevice`.
pub const USB_CLASS_CDC: u8 = 0x02;
diff --git a/embassy-usb-hid/src/lib.rs b/embassy-usb/src/class/hid.rs
index 8b181aec..4d1fa995 100644
--- a/embassy-usb-hid/src/lib.rs
+++ b/embassy-usb/src/class/hid.rs
@@ -1,23 +1,16 @@
-#![no_std]
-#![feature(type_alias_impl_trait)]
-
-//! Implements HID functionality for a usb-device device.
-
-// This mod MUST go first, so that the others see its macros.
-pub(crate) mod fmt;
-
use core::mem::MaybeUninit;
use core::ops::Range;
use core::sync::atomic::{AtomicUsize, Ordering};
-use embassy_usb::control::{ControlHandler, InResponse, OutResponse, Request, RequestType};
-use embassy_usb::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
-use embassy_usb::Builder;
#[cfg(feature = "usbd-hid")]
use ssmarshal::serialize;
#[cfg(feature = "usbd-hid")]
use usbd_hid::descriptor::AsInputReport;
+use crate::control::{ControlHandler, InResponse, OutResponse, Request, RequestType};
+use crate::driver::{Driver, Endpoint, EndpointError, EndpointIn, EndpointOut};
+use crate::Builder;
+
const USB_CLASS_HID: u8 = 0x03;
const USB_SUBCLASS_NONE: u8 = 0x00;
const USB_PROTOCOL_NONE: u8 = 0x00;
@@ -204,9 +197,9 @@ pub enum ReadError {
Sync(Range<usize>),
}
-impl From<embassy_usb::driver::EndpointError> for ReadError {
- fn from(val: embassy_usb::driver::EndpointError) -> Self {
- use embassy_usb::driver::EndpointError::*;
+impl From<EndpointError> for ReadError {
+ fn from(val: EndpointError) -> Self {
+ use EndpointError::*;
match val {
BufferOverflow => ReadError::BufferOverflow,
Disabled => ReadError::Disabled,
@@ -437,7 +430,7 @@ impl<'d> ControlHandler for Control<'d> {
}
}
- fn control_out(&mut self, req: embassy_usb::control::Request, data: &[u8]) -> OutResponse {
+ fn control_out(&mut self, req: Request, data: &[u8]) -> OutResponse {
trace!("HID control_out {:?} {=[u8]:x}", req, data);
if let RequestType::Class = req.request_type {
match req.request {
diff --git a/embassy-usb/src/class/mod.rs b/embassy-usb/src/class/mod.rs
new file mode 100644
index 00000000..af27577a
--- /dev/null
+++ b/embassy-usb/src/class/mod.rs
@@ -0,0 +1,3 @@
+pub mod cdc_acm;
+pub mod cdc_ncm;
+pub mod hid;
diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs
index e1a99cfa..661b8411 100644
--- a/embassy-usb/src/lib.rs
+++ b/embassy-usb/src/lib.rs
@@ -7,6 +7,7 @@ pub(crate) mod fmt;
pub use embassy_usb_driver as driver;
mod builder;
+pub mod class;
pub mod control;
pub mod descriptor;
mod descriptor_reader;
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml
index dbc659cd..a5d340c6 100644
--- a/examples/nrf/Cargo.toml
+++ b/examples/nrf/Cargo.toml
@@ -5,7 +5,7 @@ version = "0.1.0"
[features]
default = ["nightly"]
-nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-net/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"]
+nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-net/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embedded-io/async", "embassy-net"]
[dependencies]
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
@@ -15,9 +15,6 @@ embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["de
embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true }
-embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"], optional = true }
-embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"], optional = true }
-embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"], optional = true }
embedded-io = "0.3.0"
defmt = "0.3"
diff --git a/examples/nrf/src/bin/usb_ethernet.rs b/examples/nrf/src/bin/usb_ethernet.rs
index 33ca380f..de93a2b4 100644
--- a/examples/nrf/src/bin/usb_ethernet.rs
+++ b/examples/nrf/src/bin/usb_ethernet.rs
@@ -15,8 +15,8 @@ use embassy_nrf::usb::{Driver, PowerUsb};
use embassy_nrf::{interrupt, pac, peripherals};
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
+use embassy_usb::class::cdc_ncm::{CdcNcmClass, Receiver, Sender, State};
use embassy_usb::{Builder, Config, UsbDevice};
-use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
use embedded_io::asynch::Write;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/nrf/src/bin/usb_hid_keyboard.rs b/examples/nrf/src/bin/usb_hid_keyboard.rs
index 4eb7d37c..76e19871 100644
--- a/examples/nrf/src/bin/usb_hid_keyboard.rs
+++ b/examples/nrf/src/bin/usb_hid_keyboard.rs
@@ -14,9 +14,9 @@ use embassy_nrf::usb::{Driver, PowerUsb};
use embassy_nrf::{interrupt, pac};
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_sync::signal::Signal;
+use embassy_usb::class::hid::{HidReaderWriter, ReportId, RequestHandler, State};
use embassy_usb::control::OutResponse;
use embassy_usb::{Builder, Config, DeviceStateHandler};
-use embassy_usb_hid::{HidReaderWriter, ReportId, RequestHandler, State};
use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor};
use {defmt_rtt as _, panic_probe as _};
@@ -67,7 +67,7 @@ async fn main(_spawner: Spawner) {
);
// Create classes on the builder.
- let config = embassy_usb_hid::Config {
+ let config = embassy_usb::class::hid::Config {
report_descriptor: KeyboardReport::desc(),
request_handler: Some(&request_handler),
poll_ms: 60,
diff --git a/examples/nrf/src/bin/usb_hid_mouse.rs b/examples/nrf/src/bin/usb_hid_mouse.rs
index 65fbda1c..4916a38d 100644
--- a/examples/nrf/src/bin/usb_hid_mouse.rs
+++ b/examples/nrf/src/bin/usb_hid_mouse.rs
@@ -10,9 +10,9 @@ use embassy_futures::join::join;
use embassy_nrf::usb::{Driver, PowerUsb};
use embassy_nrf::{interrupt, pac};
use embassy_time::{Duration, Timer};
+use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler, State};
use embassy_usb::control::OutResponse;
use embassy_usb::{Builder, Config};
-use embassy_usb_hid::{HidWriter, ReportId, RequestHandler, State};
use usbd_hid::descriptor::{MouseReport, SerializedDescriptor};
use {defmt_rtt as _, panic_probe as _};
@@ -59,7 +59,7 @@ async fn main(_spawner: Spawner) {
);
// Create classes on the builder.
- let config = embassy_usb_hid::Config {
+ let config = embassy_usb::class::hid::Config {
report_descriptor: MouseReport::desc(),
request_handler: Some(&request_handler),
poll_ms: 60,
diff --git a/examples/nrf/src/bin/usb_serial.rs b/examples/nrf/src/bin/usb_serial.rs
index a740b4e0..7c9c4184 100644
--- a/examples/nrf/src/bin/usb_serial.rs
+++ b/examples/nrf/src/bin/usb_serial.rs
@@ -9,9 +9,9 @@ use embassy_executor::Spawner;
use embassy_futures::join::join;
use embassy_nrf::usb::{Driver, Instance, PowerUsb, UsbSupply};
use embassy_nrf::{interrupt, pac};
+use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::driver::EndpointError;
use embassy_usb::{Builder, Config};
-use embassy_usb_serial::{CdcAcmClass, State};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
diff --git a/examples/nrf/src/bin/usb_serial_multitask.rs b/examples/nrf/src/bin/usb_serial_multitask.rs
index c646c0bb..93efc2fe 100644
--- a/examples/nrf/src/bin/usb_serial_multitask.rs
+++ b/examples/nrf/src/bin/usb_serial_multitask.rs
@@ -8,9 +8,9 @@ use defmt::{info, panic, unwrap};
use embassy_executor::Spawner;
use embassy_nrf::usb::{Driver, PowerUsb};
use embassy_nrf::{interrupt, pac, peripherals};
+use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::driver::EndpointError;
use embassy_usb::{Builder, Config, UsbDevice};
-use embassy_usb_serial::{CdcAcmClass, State};
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 24c3cdd6..3c8f923e 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -10,9 +10,7 @@ embassy-executor = { version = "0.1.0", path = "../../embassy-executor", feature
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
-embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
-embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
defmt = "0.3"
diff --git a/examples/rp/src/bin/usb_ethernet.rs b/examples/rp/src/bin/usb_ethernet.rs
index 166ffe17..1057fe7f 100644
--- a/examples/rp/src/bin/usb_ethernet.rs
+++ b/examples/rp/src/bin/usb_ethernet.rs
@@ -13,8 +13,8 @@ use embassy_rp::usb::Driver;
use embassy_rp::{interrupt, peripherals};
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
+use embassy_usb::class::cdc_ncm::{CdcNcmClass, Receiver, Sender, State};
use embassy_usb::{Builder, Config, UsbDevice};
-use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
use embedded_io::asynch::Write;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/rp/src/bin/usb_serial.rs b/examples/rp/src/bin/usb_serial.rs
index bf92a163..b7d6493b 100644
--- a/examples/rp/src/bin/usb_serial.rs
+++ b/examples/rp/src/bin/usb_serial.rs
@@ -7,9 +7,9 @@ use embassy_executor::Spawner;
use embassy_futures::join::join;
use embassy_rp::interrupt;
use embassy_rp::usb::{Driver, Instance};
+use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::driver::EndpointError;
use embassy_usb::{Builder, Config};
-use embassy_usb_serial::{CdcAcmClass, State};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml
index 895e043d..e6553789 100644
--- a/examples/stm32f1/Cargo.toml
+++ b/examples/stm32f1/Cargo.toml
@@ -9,7 +9,6 @@ embassy-executor = { version = "0.1.0", path = "../../embassy-executor", feature
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
-embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
defmt = "0.3"
diff --git a/examples/stm32f1/src/bin/usb_serial.rs b/examples/stm32f1/src/bin/usb_serial.rs
index a14e728b..ad92cdeb 100644
--- a/examples/stm32f1/src/bin/usb_serial.rs
+++ b/examples/stm32f1/src/bin/usb_serial.rs
@@ -10,9 +10,9 @@ use embassy_stm32::time::Hertz;
use embassy_stm32::usb::{Driver, Instance};
use embassy_stm32::{interrupt, Config};
use embassy_time::{Duration, Timer};
+use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::driver::EndpointError;
use embassy_usb::Builder;
-use embassy_usb_serial::{CdcAcmClass, State};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml
index 27f5c260..f5b0b880 100644
--- a/examples/stm32f3/Cargo.toml
+++ b/examples/stm32f3/Cargo.toml
@@ -9,8 +9,6 @@ embassy-executor = { version = "0.1.0", path = "../../embassy-executor", feature
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f303ze", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
-embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
-embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
defmt = "0.3"
diff --git a/examples/stm32f3/src/bin/usb_serial.rs b/examples/stm32f3/src/bin/usb_serial.rs
index b9fd20e2..f6d27c86 100644
--- a/examples/stm32f3/src/bin/usb_serial.rs
+++ b/examples/stm32f3/src/bin/usb_serial.rs
@@ -10,9 +10,9 @@ use embassy_stm32::time::mhz;
use embassy_stm32::usb::{Driver, Instance};
use embassy_stm32::{interrupt, Config};
use embassy_time::{Duration, Timer};
+use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::driver::EndpointError;
use embassy_usb::Builder;
-use embassy_usb_serial::{CdcAcmClass, State};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index 05945f6b..9ebab647 100644
--- a/examples/stm32l5/Cargo.toml
+++ b/examples/stm32l5/Cargo.toml
@@ -11,9 +11,6 @@ embassy-executor = { version = "0.1.0", path = "../../embassy-executor", feature
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "unstable-traits", "memory-x"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
-embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
-embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] }
-embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] }
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
usbd-hid = "0.6.0"
diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs
index c96a83ea..4f36d3f5 100644
--- a/examples/stm32l5/src/bin/usb_ethernet.rs
+++ b/examples/stm32l5/src/bin/usb_ethernet.rs
@@ -15,8 +15,8 @@ use embassy_stm32::usb::Driver;
use embassy_stm32::{interrupt, Config};
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
+use embassy_usb::class::cdc_ncm::{CdcNcmClass, Receiver, Sender, State};
use embassy_usb::{Builder, UsbDevice};
-use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
use embedded_io::asynch::Write;
use rand_core::RngCore;
use static_cell::StaticCell;
diff --git a/examples/stm32l5/src/bin/usb_hid_mouse.rs b/examples/stm32l5/src/bin/usb_hid_mouse.rs
index fa92ceae..d38ed749 100644
--- a/examples/stm32l5/src/bin/usb_hid_mouse.rs
+++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs
@@ -9,9 +9,9 @@ use embassy_stm32::rcc::*;
use embassy_stm32::usb::Driver;
use embassy_stm32::{interrupt, Config};
use embassy_time::{Duration, Timer};
+use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler, State};
use embassy_usb::control::OutResponse;
use embassy_usb::Builder;
-use embassy_usb_hid::{HidWriter, ReportId, RequestHandler, State};
use usbd_hid::descriptor::{MouseReport, SerializedDescriptor};
use {defmt_rtt as _, panic_probe as _};
@@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
);
// Create classes on the builder.
- let config = embassy_usb_hid::Config {
+ let config = embassy_usb::class::hid::Config {
report_descriptor: MouseReport::desc(),
request_handler: Some(&request_handler),
poll_ms: 60,
diff --git a/examples/stm32l5/src/bin/usb_serial.rs b/examples/stm32l5/src/bin/usb_serial.rs
index 7484dc83..7562a4e9 100644
--- a/examples/stm32l5/src/bin/usb_serial.rs
+++ b/examples/stm32l5/src/bin/usb_serial.rs
@@ -8,9 +8,9 @@ use embassy_futures::join::join;
use embassy_stm32::rcc::*;
use embassy_stm32::usb::{Driver, Instance};
use embassy_stm32::{interrupt, Config};
+use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
use embassy_usb::driver::EndpointError;
use embassy_usb::Builder;
-use embassy_usb_serial::{CdcAcmClass, State};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]