From 9968ada7a0776d33fc6f320cc17335624b1873ed Mon Sep 17 00:00:00 2001 From: hodasemi Date: Mon, 11 Mar 2024 08:30:44 +0100 Subject: [PATCH] Expose error --- src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 } }