diff options
author | Brian Cully <bjc@kublai.com> | 2019-07-28 10:01:49 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-07-28 10:01:49 -0400 |
commit | b1ef816d00ad5fb6048007611c5b091e2540c306 (patch) | |
tree | 2b46c3c768518669f9e921f9c5a59a362cc4309c /usbh/src/device.rs | |
parent | 3a9c8e5c3524d2cf19a5ce3181af9ccb0337650f (diff) | |
download | samd21-demo-b1ef816d00ad5fb6048007611c5b091e2540c306.tar.gz samd21-demo-b1ef816d00ad5fb6048007611c5b091e2540c306.zip |
Rename basic USB protocol types.
Diffstat (limited to 'usbh/src/device.rs')
-rw-r--r-- | usbh/src/device.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/usbh/src/device.rs b/usbh/src/device.rs index d824aab..f300aa4 100644 --- a/usbh/src/device.rs +++ b/usbh/src/device.rs @@ -9,7 +9,7 @@ use log::{debug, error, info, trace}; use atsamd_hal::target_device::usb; const MAX_DEVICES: usize = 16; -const MAX_ENDPOINTS: usize = 8; +const MAX_ENDPOINTS: usize = 16; // How long to wait before talking to the device again after setting // its address. cf ยง9.2.6.3 of USB 2.0 @@ -139,11 +139,11 @@ impl Device { let mut pipe = pipe_table.pipe_for(host, self.addr, 0); let mut vol_descr = - ::vcell::VolatileCell::<USBDeviceDescriptor>::new(Default::default()); + ::vcell::VolatileCell::<DeviceDescriptor>::new(Default::default()); pipe.control_req( - BMRequestType::get_descr(), - USBRequest::GetDescriptor, - WValue::from((0, USBDescriptor::Device as u8)), + RequestType::get_descr(), + RequestCode::GetDescriptor, + WValue::from((0, DescriptorType::Device as u8)), 0, Some(DataBuf::from(&mut vol_descr)), self.millis, @@ -161,11 +161,11 @@ impl Device { let mut pipe = pipe_table.pipe_for(host, self.addr, 0); let mut vol_descr = - ::vcell::VolatileCell::<USBConfigurationDescriptor>::new(Default::default()); + ::vcell::VolatileCell::<ConfigurationDescriptor>::new(Default::default()); pipe.control_req( - BMRequestType::get_descr(), - USBRequest::GetDescriptor, - WValue::from((0, USBDescriptor::Configuration as u8)), + RequestType::get_descr(), + RequestCode::GetDescriptor, + WValue::from((0, DescriptorType::Configuration as u8)), 0, Some(DataBuf::from(&mut vol_descr)), self.millis, @@ -178,9 +178,9 @@ impl Device { let buf: [u8; 64] = [0; 64]; let mut tmp = &buf[..desc.w_total_length as usize]; pipe.control_req( - BMRequestType::get_descr(), - USBRequest::GetDescriptor, - WValue::from((0, USBDescriptor::Configuration as u8)), + RequestType::get_descr(), + RequestCode::GetDescriptor, + WValue::from((0, DescriptorType::Configuration as u8)), 0, Some(DataBuf::from(&mut tmp)), self.millis, @@ -195,8 +195,8 @@ impl Device { debug!("+++ setting configuration"); let conf: u8 = 1; pipe.control_req( - BMRequestType::set(), - USBRequest::SetConfiguration, + RequestType::set(), + RequestCode::SetConfiguration, WValue::from((conf, 0)), 0, None, @@ -206,12 +206,12 @@ impl Device { debug!("+++ setting idle"); pipe.control_req( - BMRequestType::from(( + RequestType::from(( USBSetupDirection::HostToDevice, USBSetupType::Class, USBSetupRecipient::Interface, )), - USBRequest::GetInterface, // This is also idle, but can't have two enums with the same value. + RequestCode::GetInterface, // This is also idle, but can't have two enums with the same value. WValue::from((0, 0)), 0, None, @@ -222,12 +222,12 @@ impl Device { debug!("+++ setting report"); let mut rep_res: u8 = 0; pipe.control_req( - BMRequestType::from(( + RequestType::from(( USBSetupDirection::HostToDevice, USBSetupType::Class, USBSetupRecipient::Interface, )), - USBRequest::SetConfiguration, + RequestCode::SetConfiguration, WValue::from((0, 2)), 0, Some(DataBuf::from(&mut rep_res)), |