aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-11-30 09:47:45 -0500
committerBrian Cully <bjc@kublai.com>2022-11-30 09:47:45 -0500
commitfa42820dd4f5c14f5e6a8290045bb215b6fe0aa7 (patch)
treed49e2fd936dbe4920588e7e077205960b788522a
parente5b9d9a8a07acd095a8206cc8b51cd57771c2651 (diff)
downloadluchie-fa42820dd4f5c14f5e6a8290045bb215b6fe0aa7.tar.gz
luchie-fa42820dd4f5c14f5e6a8290045bb215b6fe0aa7.zip
usb: skip usb interface processing until configured
-rwxr-xr-xsrc/bin/luchie.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bin/luchie.rs b/src/bin/luchie.rs
index 9ea8e87..bbe06d4 100755
--- a/src/bin/luchie.rs
+++ b/src/bin/luchie.rs
@@ -166,10 +166,6 @@ fn main() -> ! {
.device_class(USB_CLASS_CDC)
.build();
- // while usb_dev.state() != UsbDeviceState::Configured {
- // usb_dev.poll(&mut [&mut serial, &mut mouse]);
- // }
-
logln!("💡 init led");
let mut gpiob = dp.GPIOB.split();
let mut led = gpiob.pb2.into_push_pull_output(&mut gpiob.crl);
@@ -183,6 +179,9 @@ fn main() -> ! {
let elapsed = sys_timer.update();
usb_dev.poll(&mut [&mut serial, &mut mouse]);
+ if usb_dev.state() != UsbDeviceState::Configured {
+ continue;
+ }
let mut buf = [0u8; 64];