fix(field): change size field type from u16 to u8

This commit is contained in:
doryan 2024-11-09 16:48:05 +04:00
parent 64424febc6
commit ddd6ee6ad2

View File

@ -14,7 +14,7 @@ use usb_device::{
#[derive(Default, Copy, Clone)] #[derive(Default, Copy, Clone)]
pub(crate) struct USBEndpoint { pub(crate) struct USBEndpoint {
is_allocated: bool, is_allocated: bool,
size: u16, size: u8,
ep_type: u8, ep_type: u8,
ep_dir: bool, ep_dir: bool,
banks: u8, banks: u8,
@ -46,7 +46,16 @@ impl USBEndpoint {
#[inline] #[inline]
fn set_size(&mut self, size: u16) { fn set_size(&mut self, size: u16) {
self.size = size; self.size = match size {
8 => 0b000,
16 => 0b001,
32 => 0b010,
64 => 0b011,
128 => 0b100,
256 => 0b101,
512 => 0b110,
_ => unreachable!(),
}
} }
} }