aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-08-10 14:19:38 -0400
committerBrian Cully <bjc@kublai.com>2019-08-10 14:19:38 -0400
commit0a8c0daa9f48093682a3197ad24d37c16dc32c99 (patch)
treed2bee1deab45a90fe1557aede6fc626b77a40764 /src/pipe
parentaab5cd2b36986c51e4a91291e0a083795b0c735f (diff)
downloadatsamd-usb-host-0a8c0daa9f48093682a3197ad24d37c16dc32c99.tar.gz
atsamd-usb-host-0a8c0daa9f48093682a3197ad24d37c16dc32c99.zip
Use endpoint's max packet size for pipe.
Diffstat (limited to 'src/pipe')
-rw-r--r--src/pipe/pck_size.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pipe/pck_size.rs b/src/pipe/pck_size.rs
index acc499f..c95140d 100644
--- a/src/pipe/pck_size.rs
+++ b/src/pipe/pck_size.rs
@@ -29,6 +29,16 @@ impl PckSize {
f(&mut w);
self.0 = w.bits;
}
+
+ pub fn modify<F>(&mut self, f: F)
+ where
+ for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
+ {
+ let r = R { bits: self.0 };
+ let mut w = W { bits: self.0 };
+ f(&r, &mut w);
+ self.0 = w.bits;
+ }
}
impl From<u32> for PckSize {