aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src/device.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-07-28 11:49:20 -0400
committerBrian Cully <bjc@kublai.com>2019-07-28 11:49:20 -0400
commit2f69a27f33028fcd437c33c75b4cbcd7d230d5bc (patch)
tree3e9226d79a9da400291b840cdb79ce359170aee2 /usbh/src/device.rs
parentbf96d94e22973cf8a3faa2e707aac1f6ce977685 (diff)
downloadsamd21-demo-2f69a27f33028fcd437c33c75b4cbcd7d230d5bc.tar.gz
samd21-demo-2f69a27f33028fcd437c33c75b4cbcd7d230d5bc.zip
Remove DataBuf exposure outside of pipe impl.
Diffstat (limited to 'usbh/src/device.rs')
-rw-r--r--usbh/src/device.rs29
1 files changed, 14 insertions, 15 deletions
diff --git a/usbh/src/device.rs b/usbh/src/device.rs
index f300aa4..eeaa33b 100644
--- a/usbh/src/device.rs
+++ b/usbh/src/device.rs
@@ -1,4 +1,4 @@
-use super::pipe::{DataBuf, Pipe, PipeErr, PipeTable};
+use super::pipe::{Pipe, PipeErr, PipeTable};
use super::usbproto::*;
use core::convert::TryInto;
@@ -145,7 +145,7 @@ impl Device {
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Device as u8)),
0,
- Some(DataBuf::from(&mut vol_descr)),
+ Some(&mut vol_descr),
self.millis,
)?;
@@ -167,7 +167,7 @@ impl Device {
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Configuration as u8)),
0,
- Some(DataBuf::from(&mut vol_descr)),
+ Some(&mut vol_descr),
self.millis,
)?;
let desc = vol_descr.get();
@@ -182,7 +182,7 @@ impl Device {
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Configuration as u8)),
0,
- Some(DataBuf::from(&mut tmp)),
+ Some(&mut tmp),
self.millis,
)?;
@@ -199,7 +199,7 @@ impl Device {
RequestCode::SetConfiguration,
WValue::from((conf, 0)),
0,
- None,
+ Option::<&mut ()>::None,
self.millis,
)?;
debug!(" -- configuration set");
@@ -207,14 +207,14 @@ impl Device {
debug!("+++ setting idle");
pipe.control_req(
RequestType::from((
- USBSetupDirection::HostToDevice,
- USBSetupType::Class,
- USBSetupRecipient::Interface,
+ RequestDirection::HostToDevice,
+ RequestKind::Class,
+ RequestRecipient::Interface,
)),
RequestCode::GetInterface, // This is also idle, but can't have two enums with the same value.
WValue::from((0, 0)),
0,
- None,
+ Option::<&mut ()>::None,
self.millis,
)?;
debug!(" -- idle set");
@@ -223,14 +223,14 @@ impl Device {
let mut rep_res: u8 = 0;
pipe.control_req(
RequestType::from((
- USBSetupDirection::HostToDevice,
- USBSetupType::Class,
- USBSetupRecipient::Interface,
+ RequestDirection::HostToDevice,
+ RequestKind::Class,
+ RequestRecipient::Interface,
)),
RequestCode::SetConfiguration,
WValue::from((0, 2)),
0,
- Some(DataBuf::from(&mut rep_res)),
+ Some(&mut rep_res),
self.millis,
)?;
debug!(" -- report set: {}", rep_res);
@@ -264,8 +264,7 @@ impl Device {
fn read_report(&mut self, pipe: &mut Pipe, id: u8) {
let mut buf: core::mem::MaybeUninit<[u8; 64]> = core::mem::MaybeUninit::uninit();
- let mut db = DataBuf::from(&mut buf);
- match pipe.in_transfer(&mut db, 15, self.millis) {
+ match pipe.in_transfer(&mut buf, 15, self.millis) {
Ok(bytes_received) => {
let tmp = unsafe { &(buf.assume_init())[..bytes_received] };
info!("report {}: {:?}", id, tmp);