Pass config directly to chip specific configure function
This removes the need to duplicate the configuration for each individual chip, but will instead pass on the configuration specified in the config attribute. Update nrf, stm32, rp macros with passing the config to a per-chip configure function which assumes the appropriate configuration to be passed to it. To demonstrate this feature, the stm32l0xx clock setup and RTC is added which exposes clock configuration different from stm32f4xx (and has a different set of timers and HAL APIs).
This commit is contained in:
@ -10,6 +10,7 @@ use example_common::*;
|
||||
|
||||
use defmt::panic;
|
||||
use embassy;
|
||||
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_stm32;
|
||||
@ -31,7 +32,7 @@ async fn run2() {
|
||||
}
|
||||
}
|
||||
|
||||
#[embassy::main(use_hse = 16)]
|
||||
#[embassy::main(config = "embassy_stm32::system::Config::new().use_hse(16)")]
|
||||
async fn main(spawner: Spawner) {
|
||||
let (dp, clocks) = embassy_stm32::Peripherals::take().unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ use embassy_stm32::pac as stm32;
|
||||
use embassy_stm32::serial;
|
||||
use futures::pin_mut;
|
||||
|
||||
#[embassy::main(use_hse = 16, sysclk = 48, pclk1 = 24)]
|
||||
#[embassy::main(config = "embassy_stm32::system::Config::new().use_hse(16).sysclk(48).pclk1(24)")]
|
||||
async fn main(spawner: Spawner) {
|
||||
let (dp, clocks) = embassy_stm32::Peripherals::take().unwrap();
|
||||
let cp = cortex_m::peripheral::Peripherals::take().unwrap();
|
||||
|
@ -92,7 +92,9 @@ async fn run1(bus: &'static mut UsbBusAllocator<UsbBus<USB>>) {
|
||||
|
||||
static USB_BUS: Forever<UsbBusAllocator<UsbBus<USB>>> = Forever::new();
|
||||
|
||||
#[embassy::main(use_hse = 25, sysclk = 48, require_pll48clk)]
|
||||
#[embassy::main(
|
||||
config = "embassy_stm32::system::Config::new().use_hse(25).sysclk(48).require_pll48clk()"
|
||||
)]
|
||||
async fn main(spawner: Spawner) -> ! {
|
||||
static mut EP_MEMORY: [u32; 1024] = [0; 1024];
|
||||
|
||||
|
Reference in New Issue
Block a user