diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-17 22:25:58 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-17 22:25:58 +0200 |
| commit | 2e85eaf7d5f4dcf6d84f426542b8ec87aa51c429 (patch) | |
| tree | 1d22c32eae26435677df89083d71f50fc298a09f /examples/stm32l5/src/bin/usb_ethernet.rs | |
| parent | fc6e1e06b305d302d1b7ad17e8ef3a9be986c358 (diff) | |
examples Remove the `fn config()` idiom.
It was only useful for doing #[embassy_executor::main(config = "config()")]`. Now that
it's gone, it makes more sense to build the config in main directly.
Diffstat (limited to 'examples/stm32l5/src/bin/usb_ethernet.rs')
| -rw-r--r-- | examples/stm32l5/src/bin/usb_ethernet.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs index cc7578990..769b67a2b 100644 --- a/examples/stm32l5/src/bin/usb_ethernet.rs +++ b/examples/stm32l5/src/bin/usb_ethernet.rs | |||
| @@ -83,19 +83,13 @@ async fn net_task(stack: &'static Stack<Device>) -> ! { | |||
| 83 | stack.run().await | 83 | stack.run().await |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | fn config() -> Config { | 86 | #[embassy_executor::main] |
| 87 | async fn main(spawner: Spawner) { | ||
| 87 | let mut config = Config::default(); | 88 | let mut config = Config::default(); |
| 88 | config.rcc.mux = ClockSrc::HSE(Hertz(16_000_000)); | ||
| 89 | |||
| 90 | config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None); | 89 | config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None); |
| 91 | config.rcc.hsi48 = true; | 90 | config.rcc.hsi48 = true; |
| 91 | let p = embassy_stm32::init(config); | ||
| 92 | 92 | ||
| 93 | config | ||
| 94 | } | ||
| 95 | |||
| 96 | #[embassy_executor::main] | ||
| 97 | async fn main(spawner: Spawner) { | ||
| 98 | let p = embassy_stm32::init(config()); | ||
| 99 | // Create the driver, from the HAL. | 93 | // Create the driver, from the HAL. |
| 100 | let irq = interrupt::take!(USB_FS); | 94 | let irq = interrupt::take!(USB_FS); |
| 101 | let driver = Driver::new(p.USB, irq, p.PA12, p.PA11); | 95 | let driver = Driver::new(p.USB, irq, p.PA12, p.PA11); |
