Skip to content

Commit 793bafe

Browse files
Disasmhannobraun
andauthored
Apply suggestions from code review
Co-Authored-By: Hanno Braun <hanno@braun-embedded.com>
1 parent f37f6ad commit 793bafe

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/usb_serial.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate panic_semihosting;
66

77
use cortex_m_rt::entry;
88
use stm32l0xx_hal::usb::{Peripheral, UsbBus};
9-
use stm32l0xx_hal::{pac, prelude::*, rcc};
9+
use stm32l0xx_hal::{pac, prelude::*, rcc, syscfg::SYSCFG};
1010
use usb_device::prelude::*;
1111
use usbd_serial::{SerialPort, USB_CLASS_CDC};
1212

@@ -15,6 +15,8 @@ fn main() -> ! {
1515
let dp = pac::Peripherals::take().unwrap();
1616

1717
let mut rcc = dp.RCC.freeze(rcc::Config::hsi16());
18+
let mut syscfg = SYSCFG::new(dp.SYSCFG_COMP, &mut rcc);
19+
rcc.enable_hsi48(&mut syscfg, dp.CRS);
1820

1921
let gpioa = dp.GPIOA.split(&mut rcc);
2022

src/usb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ unsafe impl UsbPeripheral for Peripheral {
4545
}
4646

4747
fn startup_delay() {
48-
// There is a chip specific startup delay. For STM32F103xx it's 1µs and this should wait for
48+
// There is a chip specific startup delay. For STM32L0x2/x3 it's 1µs and this should wait for
4949
// at least that long.
50-
cortex_m::asm::delay(72);
50+
cortex_m::asm::delay(32);
5151
}
5252
}
5353

0 commit comments

Comments
 (0)