From 4ca8c4e8cf5fc630054fd9ea99e54d4682cd3eb0 Mon Sep 17 00:00:00 2001 From: doryan Date: Sat, 9 Nov 2024 16:48:28 +0400 Subject: [PATCH] feat(code): format code --- src/types/usb_device.rs | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/types/usb_device.rs b/src/types/usb_device.rs index fdccbf3..d5525b7 100644 --- a/src/types/usb_device.rs +++ b/src/types/usb_device.rs @@ -2,12 +2,12 @@ use core::cmp::max; use avr_device::{ atmega32u4::{PLL, USB_DEVICE}, - interrupt::{free, Mutex}, + interrupt::{free, CriticalSection, Mutex}, }; use usb_device::{ - bus::UsbBus, + bus::{PollResult, UsbBus}, endpoint::{EndpointAddress, EndpointType}, - Result, UsbDirection, UsbError, + Result as UsbResult, UsbDirection, UsbError, }; #[allow(unused)] @@ -20,7 +20,7 @@ pub(crate) struct USBEndpoint { banks: u8, } -const ENDPOINTS_ALLOC_LAYOUT : [u16; 7] = [64, 256, 64, 64, 64, 64, 64]; +const ENDPOINTS_ALLOC_LAYOUT: [u16; 7] = [64, 256, 64, 64, 64, 64, 64]; impl USBEndpoint { #[inline] @@ -80,6 +80,7 @@ impl UsbDevice { dpram_already_used: 0, } } + pub fn select_endpoint( &mut self, cs: CriticalSection<'_>, @@ -100,6 +101,7 @@ impl UsbDevice { Ok(()) } + pub fn configure_endpoint( &mut self, cs: CriticalSection<'_>, @@ -263,19 +265,15 @@ impl UsbBus for UsbDevice { }) } - fn is_stalled(&self, ep_addr: usb_device::endpoint::EndpointAddress) -> bool { + fn is_stalled(&self, ep_addr: EndpointAddress) -> bool { todo!(); } - fn poll(&self) -> usb_device::bus::PollResult { + fn poll(&self) -> PollResult { todo!(); } - fn read( - &self, - ep_addr: usb_device::endpoint::EndpointAddress, - buf: &mut [u8], - ) -> usb_device::Result { + fn read(&self, ep_addr: EndpointAddress, buf: &mut [u8]) -> usb_device::Result { todo!(); } @@ -325,7 +323,7 @@ impl UsbBus for UsbDevice { }); } - fn set_stalled(&self, ep_addr: usb_device::endpoint::EndpointAddress, stalled: bool) { + fn set_stalled(&self, ep_addr: EndpointAddress, stalled: bool) { todo!(); } @@ -333,11 +331,7 @@ impl UsbBus for UsbDevice { todo!(); } - fn write( - &self, - ep_addr: usb_device::endpoint::EndpointAddress, - buf: &[u8], - ) -> usb_device::Result { + fn write(&self, ep_addr: EndpointAddress, buf: &[u8]) -> UsbResult { todo!(); } }