changes to get usb working on a L1. Adds a usb_serial example too

This commit is contained in:
shufps 2024-01-14 22:43:22 +01:00
parent 131ef00658
commit 018c48cf1c
2 changed files with 7 additions and 0 deletions

View file

@ -286,7 +286,10 @@ impl<'d, T: Instance> Driver<'d, T> {
#[cfg(not(usb_v4))]
regs.btable().write(|w| w.set_btable(0));
#[cfg(not(stm32l1))]
dp.set_as_af(dp.af_num(), AFType::OutputPushPull);
#[cfg(not(stm32l1))]
dm.set_as_af(dm.af_num(), AFType::OutputPushPull);
// Initialize the bus so that it signals that power is available
@ -444,6 +447,9 @@ impl<'d, T: Instance> driver::Driver<'d> for Driver<'d, T> {
#[cfg(any(usb_v3, usb_v4))]
regs.bcdr().write(|w| w.set_dppu(true));
#[cfg(stm32l1)]
crate::pac::SYSCFG.pmc().modify(|w| w.set_usb_pu(true));
trace!("enabled");
let mut ep_types = [EpType::BULK; EP_COUNT - 1];

View file

@ -9,6 +9,7 @@ embassy-sync = { version = "0.5.0", path = "../../embassy-sync", features = ["de
embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
embassy-time = { version = "0.3.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
defmt = "0.3"
defmt-rtt = "0.4"