Implement embedded-io-async traits for USB CDC ACM

This commit is contained in:
Matt Rodgers
2025-05-07 21:15:54 +01:00
parent 6c6ae4f9fc
commit d46d3119ce
4 changed files with 110 additions and 0 deletions

View File

@@ -20,3 +20,4 @@ features = ["defmt"]
[dependencies]
defmt = { version = "0.3", optional = true }
embedded-io-async = "0.6.1"

View File

@@ -395,3 +395,12 @@ pub enum EndpointError {
/// The endpoint is disabled.
Disabled,
}
impl embedded_io_async::Error for EndpointError {
fn kind(&self) -> embedded_io_async::ErrorKind {
match self {
Self::BufferOverflow => embedded_io_async::ErrorKind::OutOfMemory,
Self::Disabled => embedded_io_async::ErrorKind::NotConnected,
}
}
}