diff options
| author | Jomer.Dev <[email protected]> | 2024-01-08 00:39:32 +0100 |
|---|---|---|
| committer | Jomer.Dev <[email protected]> | 2024-01-08 00:39:32 +0100 |
| commit | 2c6b475f4e663402fd87977d77dcfc4ccb70babb (patch) | |
| tree | a87f78d026ed5208ce9b123539265363033366da | |
| parent | 03bf72f690f341b9ca7dbcd329df7571fe47d014 (diff) | |
Fix formatting
| -rw-r--r-- | embassy-usb-logger/src/lib.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/embassy-usb-logger/src/lib.rs b/embassy-usb-logger/src/lib.rs index f197c6874..a057fcf32 100644 --- a/embassy-usb-logger/src/lib.rs +++ b/embassy-usb-logger/src/lib.rs | |||
| @@ -111,7 +111,7 @@ impl<const N: usize> UsbLogger<N> { | |||
| 111 | 111 | ||
| 112 | /// Creates the futures needed for the logger from a given class | 112 | /// Creates the futures needed for the logger from a given class |
| 113 | /// This can be used in cases where the usb device is already in use for another connection | 113 | /// This can be used in cases where the usb device is already in use for another connection |
| 114 | pub async fn create_future_from_class<'d, D>(&'d self, class: CdcAcmClass<'d, D> ) | 114 | pub async fn create_future_from_class<'d, D>(&'d self, class: CdcAcmClass<'d, D>) |
| 115 | where | 115 | where |
| 116 | D: Driver<'d>, | 116 | D: Driver<'d>, |
| 117 | { | 117 | { |
| @@ -121,7 +121,7 @@ impl<const N: usize> UsbLogger<N> { | |||
| 121 | loop { | 121 | loop { |
| 122 | let log_fut = async { | 122 | let log_fut = async { |
| 123 | let mut rx: [u8; MAX_PACKET_SIZE as usize] = [0; MAX_PACKET_SIZE as usize]; | 123 | let mut rx: [u8; MAX_PACKET_SIZE as usize] = [0; MAX_PACKET_SIZE as usize]; |
| 124 | sender.wait_connection().await; | 124 | sender.wait_connection().await; |
| 125 | loop { | 125 | loop { |
| 126 | let len = self.buffer.read(&mut rx[..]).await; | 126 | let len = self.buffer.read(&mut rx[..]).await; |
| 127 | let _ = sender.write_packet(&rx[..len]).await; | 127 | let _ = sender.write_packet(&rx[..len]).await; |
| @@ -204,13 +204,11 @@ macro_rules! run { | |||
| 204 | /// This macro should only be invoked only once since it is setting the global logging state of the application. | 204 | /// This macro should only be invoked only once since it is setting the global logging state of the application. |
| 205 | #[macro_export] | 205 | #[macro_export] |
| 206 | macro_rules! with_class { | 206 | macro_rules! with_class { |
| 207 | ( $x:expr, $l:expr, $p:ident ) => { | 207 | ( $x:expr, $l:expr, $p:ident ) => {{ |
| 208 | { | 208 | static LOGGER: ::embassy_usb_logger::UsbLogger<$x> = ::embassy_usb_logger::UsbLogger::new(); |
| 209 | static LOGGER: ::embassy_usb_logger::UsbLogger<$x> = ::embassy_usb_logger::UsbLogger::new(); | 209 | unsafe { |
| 210 | unsafe { | 210 | let _ = ::log::set_logger_racy(&LOGGER).map(|()| log::set_max_level_racy($l)); |
| 211 | let _ = ::log::set_logger_racy(&LOGGER).map(|()| log::set_max_level_racy($l)); | ||
| 212 | } | ||
| 213 | LOGGER.create_future_from_class($p) | ||
| 214 | } | 211 | } |
| 215 | }; | 212 | LOGGER.create_future_from_class($p) |
| 213 | }}; | ||
| 216 | } | 214 | } |
