diff --git a/src/lib.rs b/src/lib.rs index a58bdb7..2e174ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ use embassy_rp::peripherals::USB; use embassy_rp::usb::{Driver, InterruptHandler}; use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; +pub use embassy_usb::driver::EndpointError; use embassy_usb::{Builder, Config, UsbDevice}; pub use serial_config::SerialConfig; @@ -93,11 +94,11 @@ impl Serial<'static> { } } - pub async fn send_msg(&mut self, s: &str) { - self.class.write_packet(s.as_bytes()).await.unwrap_or(()); + pub async fn send_msg(&mut self, s: &str) -> Result<(), EndpointError> { + self.class.write_packet(s.as_bytes()).await } - pub async fn send_number(&mut self, i: T, base: I) + pub async fn send_number(&mut self, i: T, base: I) -> Result<(), EndpointError> where T: NumToA, { @@ -105,6 +106,6 @@ impl Serial<'static> { let s = i.numtoa_str(base, &mut buf); - self.send_msg(s).await; + self.send_msg(s).await } }