From fa42820dd4f5c14f5e6a8290045bb215b6fe0aa7 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Wed, 30 Nov 2022 09:47:45 -0500 Subject: usb: skip usb interface processing until configured --- src/bin/luchie.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') 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]; -- cgit v1.2.3