summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2021-08-03 22:08:13 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2021-08-05 19:14:09 +0200
commit0ea6a2d8905a146c8899239fe52e739404f13e7e (patch)
tree0fdc47c7558a062787afea6d1f6a7d0ce5a2f660 /examples
parenta4c0ee6df7cd54a3b31524e2c6aaf2b15b61a4d2 (diff)
downloadembassy-0ea6a2d8905a146c8899239fe52e739404f13e7e.zip
time: replace dyn clock/alarm with a global Driver trait
Diffstat (limited to 'examples')
-rw-r--r--examples/nrf/src/bin/blinky.rs1
-rw-r--r--examples/nrf/src/bin/executor_fairness_test.rs3
-rw-r--r--examples/nrf/src/bin/gpiote_channel.rs3
-rw-r--r--examples/nrf/src/bin/gpiote_port.rs2
-rw-r--r--examples/nrf/src/bin/mpsc.rs1
-rw-r--r--examples/nrf/src/bin/multiprio.rs18
-rw-r--r--examples/nrf/src/bin/ppi.rs3
-rw-r--r--examples/nrf/src/bin/pwm.rs4
-rw-r--r--examples/nrf/src/bin/raw_spawn.rs15
-rw-r--r--examples/nrf/src/bin/timer.rs1
-rw-r--r--examples/stm32f4/src/bin/blinky.rs1
-rw-r--r--examples/stm32f4/src/bin/button_exti.rs1
-rw-r--r--examples/stm32f4/src/bin/hello.rs2
-rw-r--r--examples/stm32f4/src/bin/spi_dma.rs1
-rw-r--r--examples/stm32f4/src/bin/usart_dma.rs1
-rw-r--r--examples/stm32h7/src/bin/blinky.rs17
-rw-r--r--examples/stm32h7/src/bin/eth.rs13
-rw-r--r--examples/stm32h7/src/bin/spi.rs10
-rw-r--r--examples/stm32h7/src/bin/spi_dma.rs10
-rw-r--r--examples/stm32h7/src/bin/usart.rs11
-rw-r--r--examples/stm32h7/src/bin/usart_dma.rs11
-rw-r--r--examples/stm32l0/src/bin/blinky.rs1
-rw-r--r--examples/stm32l0/src/bin/button_exti.rs1
-rw-r--r--examples/stm32l0/src/bin/usart_dma.rs1
-rw-r--r--examples/stm32l4/src/bin/blinky.rs1
-rw-r--r--examples/stm32l4/src/bin/button_exti.rs1
-rw-r--r--examples/stm32l4/src/bin/spi_dma.rs1
-rw-r--r--examples/stm32l4/src/bin/usart_dma.rs1
28 files changed, 19 insertions, 117 deletions
diff --git a/examples/nrf/src/bin/blinky.rs b/examples/nrf/src/bin/blinky.rs
index 77b08b09..6d4561be 100644
--- a/examples/nrf/src/bin/blinky.rs
+++ b/examples/nrf/src/bin/blinky.rs
@@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive};
diff --git a/examples/nrf/src/bin/executor_fairness_test.rs b/examples/nrf/src/bin/executor_fairness_test.rs
index d874013f..2d81a755 100644
--- a/examples/nrf/src/bin/executor_fairness_test.rs
+++ b/examples/nrf/src/bin/executor_fairness_test.rs
@@ -8,10 +8,9 @@ mod example_common;
use example_common::*;
use core::task::Poll;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Instant, Timer};
-use embassy_nrf::{interrupt, Peripherals};
+use embassy_nrf::Peripherals;
#[embassy::task]
async fn run1() {
diff --git a/examples/nrf/src/bin/gpiote_channel.rs b/examples/nrf/src/bin/gpiote_channel.rs
index a132f846..a96523e6 100644
--- a/examples/nrf/src/bin/gpiote_channel.rs
+++ b/examples/nrf/src/bin/gpiote_channel.rs
@@ -7,11 +7,10 @@
mod example_common;
use example_common::*;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_nrf::gpio::{Input, Pull};
use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity};
-use embassy_nrf::{interrupt, Peripherals};
+use embassy_nrf::Peripherals;
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
diff --git a/examples/nrf/src/bin/gpiote_port.rs b/examples/nrf/src/bin/gpiote_port.rs
index a782d893..700247d3 100644
--- a/examples/nrf/src/bin/gpiote_port.rs
+++ b/examples/nrf/src/bin/gpiote_port.rs
@@ -6,12 +6,10 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::traits::gpio::{WaitForHigh, WaitForLow};
use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull};
use embassy_nrf::gpiote::PortInput;
-use embassy_nrf::interrupt;
use embassy_nrf::Peripherals;
use example_common::*;
diff --git a/examples/nrf/src/bin/mpsc.rs b/examples/nrf/src/bin/mpsc.rs
index c4c0572b..e31754eb 100644
--- a/examples/nrf/src/bin/mpsc.rs
+++ b/examples/nrf/src/bin/mpsc.rs
@@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy::util::mpsc::TryRecvError;
diff --git a/examples/nrf/src/bin/multiprio.rs b/examples/nrf/src/bin/multiprio.rs
index 7ce79168..b91bbb74 100644
--- a/examples/nrf/src/bin/multiprio.rs
+++ b/examples/nrf/src/bin/multiprio.rs
@@ -68,7 +68,7 @@ use embassy::executor::{Executor, InterruptExecutor};
use embassy::interrupt::InterruptExt;
use embassy::time::{Duration, Instant, Timer};
use embassy::util::Forever;
-use embassy_nrf::{interrupt, peripherals, rtc};
+use embassy_nrf::interrupt;
#[embassy::task]
async fn run_high() {
@@ -112,30 +112,20 @@ async fn run_low() {
}
}
-static RTC: Forever<rtc::RTC<peripherals::RTC1>> = Forever::new();
-static ALARM_HIGH: Forever<rtc::Alarm<peripherals::RTC1>> = Forever::new();
static EXECUTOR_HIGH: Forever<InterruptExecutor<interrupt::SWI1_EGU1>> = Forever::new();
-static ALARM_MED: Forever<rtc::Alarm<peripherals::RTC1>> = Forever::new();
static EXECUTOR_MED: Forever<InterruptExecutor<interrupt::SWI0_EGU0>> = Forever::new();
-static ALARM_LOW: Forever<rtc::Alarm<peripherals::RTC1>> = Forever::new();
static EXECUTOR_LOW: Forever<Executor> = Forever::new();
#[entry]
fn main() -> ! {
info!("Hello World!");
- let p = embassy_nrf::init(Default::default());
-
- let rtc = RTC.put(rtc::RTC::new(p.RTC1, interrupt::take!(RTC1)));
- rtc.start();
- unsafe { embassy::time::set_clock(rtc) };
+ let _p = embassy_nrf::init(Default::default());
// High-priority executor: SWI1_EGU1, priority level 6
let irq = interrupt::take!(SWI1_EGU1);
irq.set_priority(interrupt::Priority::P6);
- let alarm = ALARM_HIGH.put(rtc.alarm2());
let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq));
- executor.set_alarm(alarm);
executor.start(|spawner| {
unwrap!(spawner.spawn(run_high()));
});
@@ -143,17 +133,13 @@ fn main() -> ! {
// Medium-priority executor: SWI0_EGU0, priority level 7
let irq = interrupt::take!(SWI0_EGU0);
irq.set_priority(interrupt::Priority::P7);
- let alarm = ALARM_MED.put(rtc.alarm1());
let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq));
- executor.set_alarm(alarm);
executor.start(|spawner| {
unwrap!(spawner.spawn(run_med()));
});
// Low priority executor: runs in thread mode, using WFE/SEV
- let alarm = ALARM_LOW.put(rtc.alarm0());
let executor = EXECUTOR_LOW.put(Executor::new());
- executor.set_alarm(alarm);
executor.run(|spawner| {
unwrap!(spawner.spawn(run_low()));
});
diff --git a/examples/nrf/src/bin/ppi.rs b/examples/nrf/src/bin/ppi.rs
index 0bac875b..2dc3fe1b 100644
--- a/examples/nrf/src/bin/ppi.rs
+++ b/examples/nrf/src/bin/ppi.rs
@@ -8,12 +8,11 @@ mod example_common;
use example_common::*;
use core::future::pending;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
use embassy_nrf::gpiote::{self, InputChannel, InputChannelPolarity};
use embassy_nrf::ppi::Ppi;
-use embassy_nrf::{interrupt, Peripherals};
+use embassy_nrf::Peripherals;
use gpiote::{OutputChannel, OutputChannelPolarity};
#[embassy::main]
diff --git a/examples/nrf/src/bin/pwm.rs b/examples/nrf/src/bin/pwm.rs
index d2bc81ce..f30ad8f5 100644
--- a/examples/nrf/src/bin/pwm.rs
+++ b/examples/nrf/src/bin/pwm.rs
@@ -5,11 +5,11 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_nrf::pwm::{Prescaler, Pwm};
-use embassy_nrf::{interrupt, Peripherals};
+use embassy_nrf::Peripherals;
// for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='')
static DUTY: [u16; 1024] = [
diff --git a/examples/nrf/src/bin/raw_spawn.rs b/examples/nrf/src/bin/raw_spawn.rs
index 78de7b10..326dd9aa 100644
--- a/examples/nrf/src/bin/raw_spawn.rs
+++ b/examples/nrf/src/bin/raw_spawn.rs
@@ -7,13 +7,11 @@ use example_common::*;
use core::mem;
use cortex_m_rt::entry;
-use defmt::panic;
+
use embassy::executor::raw::Task;
use embassy::executor::Executor;
use embassy::time::{Duration, Timer};
use embassy::util::Forever;
-use embassy_nrf::peripherals;
-use embassy_nrf::{interrupt, rtc};
async fn run1() {
loop {
@@ -29,23 +27,14 @@ async fn run2() {
}
}
-static RTC: Forever<rtc::RTC<peripherals::RTC1>> = Forever::new();
-static ALARM: Forever<rtc::Alarm<peripherals::RTC1>> = Forever::new();
static EXECUTOR: Forever<Executor> = Forever::new();
#[entry]
fn main() -> ! {
info!("Hello World!");
- let p = embassy_nrf::init(Default::default());
-
- let rtc = RTC.put(rtc::RTC::new(p.RTC1, interrupt::take!(RTC1)));
- rtc.start();
- unsafe { embassy::time::set_clock(rtc) };
-
- let alarm = ALARM.put(rtc.alarm0());
+ let _p = embassy_nrf::init(Default::default());
let executor = EXECUTOR.put(Executor::new());
- executor.set_alarm(alarm);
let run1_task = Task::new();
let run2_task = Task::new();
diff --git a/examples/nrf/src/bin/timer.rs b/examples/nrf/src/bin/timer.rs
index 630ea87a..60cbe5a0 100644
--- a/examples/nrf/src/bin/timer.rs
+++ b/examples/nrf/src/bin/timer.rs
@@ -8,7 +8,6 @@ mod example_common;
use embassy_nrf::Peripherals;
use example_common::*;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
diff --git a/examples/stm32f4/src/bin/blinky.rs b/examples/stm32f4/src/bin/blinky.rs
index 9c695a80..00eab761 100644
--- a/examples/stm32f4/src/bin/blinky.rs
+++ b/examples/stm32f4/src/bin/blinky.rs
@@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::dbgmcu::Dbgmcu;
diff --git a/examples/stm32f4/src/bin/button_exti.rs b/examples/stm32f4/src/bin/button_exti.rs
index caebdac1..ee43fa7d 100644
--- a/examples/stm32f4/src/bin/button_exti.rs
+++ b/examples/stm32f4/src/bin/button_exti.rs
@@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
diff --git a/examples/stm32f4/src/bin/hello.rs b/examples/stm32f4/src/bin/hello.rs
index 41d80840..1b8730ae 100644
--- a/examples/stm32f4/src/bin/hello.rs
+++ b/examples/stm32f4/src/bin/hello.rs
@@ -4,7 +4,7 @@
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]
-use defmt::{info, panic};
+use defmt::info;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::time::Hertz;
diff --git a/examples/stm32f4/src/bin/spi_dma.rs b/examples/stm32f4/src/bin/spi_dma.rs
index 9f710112..a965bef7 100644
--- a/examples/stm32f4/src/bin/spi_dma.rs
+++ b/examples/stm32f4/src/bin/spi_dma.rs
@@ -8,7 +8,6 @@
mod example_common;
use core::fmt::Write;
use core::str::from_utf8;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::spi::{Config, Spi};
diff --git a/examples/stm32f4/src/bin/usart_dma.rs b/examples/stm32f4/src/bin/usart_dma.rs
index 5023075f..05a550e9 100644
--- a/examples/stm32f4/src/bin/usart_dma.rs
+++ b/examples/stm32f4/src/bin/usart_dma.rs
@@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use core::fmt::Write;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
diff --git a/examples/stm32h7/src/bin/blinky.rs b/examples/stm32h7/src/bin/blinky.rs
index 3291f5e8..b5e0c18a 100644
--- a/examples/stm32h7/src/bin/blinky.rs
+++ b/examples/stm32h7/src/bin/blinky.rs
@@ -6,30 +6,29 @@
#[path = "../example_common.rs"]
mod example_common;
+use embassy::executor::Spawner;
+use embassy::time::{Duration, Timer};
+use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Level, Output, Speed};
+use embassy_stm32::Peripherals;
use embedded_hal::digital::v2::OutputPin;
use example_common::*;
-use cortex_m_rt::entry;
-use embassy_stm32::dbgmcu::Dbgmcu;
-
-#[entry]
-fn main() -> ! {
+#[embassy::main]
+async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
unsafe { Dbgmcu::enable_all() };
- let p = embassy_stm32::init(Default::default());
-
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
loop {
info!("high");
led.set_high().unwrap();
- cortex_m::asm::delay(10_000_000);
+ Timer::after(Duration::from_millis(500)).await;
info!("low");
led.set_low().unwrap();
- cortex_m::asm::delay(10_000_000);
+ Timer::after(Duration::from_millis(500)).await;
}
}
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs
index 6c4ba6eb..e8d13876 100644
--- a/examples/stm32h7/src/bin/eth.rs
+++ b/examples/stm32h7/src/bin/eth.rs
@@ -19,7 +19,6 @@ use embassy_macros::interrupt_take;
use embassy_net::{
Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket,
};
-use embassy_stm32::clock::{Alarm, Clock};
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::eth::lan8742a::LAN8742A;
use embassy_stm32::eth::{Ethernet, State};
@@ -27,7 +26,7 @@ use embassy_stm32::rng::Random;
use embassy_stm32::{interrupt, peripherals};
use heapless::Vec;
use panic_probe as _;
-use peripherals::{RNG, TIM2};
+use peripherals::RNG;
#[embassy::task]
async fn main_task(
@@ -86,8 +85,6 @@ fn _embassy_rand(buf: &mut [u8]) {
static mut RNG_INST: Option<Random<RNG>> = None;
static EXECUTOR: Forever<Executor> = Forever::new();
-static TIMER_RTC: Forever<Clock<TIM2>> = Forever::new();
-static ALARM: Forever<Alarm<TIM2>> = Forever::new();
static STATE: Forever<State<'static, 4, 4>> = Forever::new();
static ETH: Forever<Ethernet<'static, LAN8742A, 4, 4>> = Forever::new();
static CONFIG: Forever<StaticConfigurator> = Forever::new();
@@ -105,13 +102,6 @@ fn main() -> ! {
let p = embassy_stm32::init(config());
- let rtc_int = interrupt_take!(TIM2);
- let rtc = TIMER_RTC.put(Clock::new(p.TIM2, rtc_int));
- rtc.start();
- let alarm = ALARM.put(rtc.alarm1());
-
- unsafe { embassy::time::set_clock(rtc) };
-
let rng = Random::new(p.RNG);
unsafe {
RNG_INST.replace(rng);
@@ -136,7 +126,6 @@ fn main() -> ! {
let config = CONFIG.put(config);
let executor = EXECUTOR.put(Executor::new());
- executor.set_alarm(alarm);
executor.run(move |spawner| {
unwrap!(spawner.spawn(main_task(eth, config, spawner)));
diff --git a/examples/stm32h7/src/bin/spi.rs b/examples/stm32h7/src/bin/spi.rs
index 5175538d..047b6584 100644
--- a/examples/stm32h7/src/bin/spi.rs
+++ b/examples/stm32h7/src/bin/spi.rs
@@ -9,7 +9,6 @@ mod example_common;
use core::fmt::Write;
use embassy::executor::Executor;
-use embassy::time::Clock;
use embassy::util::Forever;
use embassy_stm32::dma::NoDma;
use embassy_stm32::spi;
@@ -38,14 +37,6 @@ async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
}
}
-struct ZeroClock;
-
-impl Clock for ZeroClock {
- fn now(&self) -> u64 {
- 0
- }
-}
-
static EXECUTOR: Forever<Executor> = Forever::new();
#[entry]
@@ -69,7 +60,6 @@ fn main() -> ! {
spi::Config::default(),
);
- unsafe { embassy::time::set_clock(&ZeroClock) };
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
diff --git a/examples/stm32h7/src/bin/spi_dma.rs b/examples/stm32h7/src/bin/spi_dma.rs
index 3b9043bc..f11b7eb4 100644
--- a/examples/stm32h7/src/bin/spi_dma.rs
+++ b/examples/stm32h7/src/bin/spi_dma.rs
@@ -9,7 +9,6 @@ mod example_common;
use core::fmt::Write;
use embassy::executor::Executor;
-use embassy::time::Clock;
use embassy::util::Forever;
use embassy_stm32::time::U32Ext;
use embassy_traits::spi::FullDuplex;
@@ -34,14 +33,6 @@ async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
}
}
-struct ZeroClock;
-
-impl Clock for ZeroClock {
- fn now(&self) -> u64 {
- 0
- }
-}
-
static EXECUTOR: Forever<Executor> = Forever::new();
#[entry]
@@ -65,7 +56,6 @@ fn main() -> ! {
spi::Config::default(),
);
- unsafe { embassy::time::set_clock(&ZeroClock) };
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
diff --git a/examples/stm32h7/src/bin/usart.rs b/examples/stm32h7/src/bin/usart.rs
index 5fa21b6a..9c93d3f2 100644
--- a/examples/stm32h7/src/bin/usart.rs
+++ b/examples/stm32h7/src/bin/usart.rs
@@ -8,7 +8,6 @@
mod example_common;
use cortex_m::prelude::_embedded_hal_blocking_serial_Write;
use embassy::executor::Executor;
-use embassy::time::Clock;
use embassy::util::Forever;
use embassy_stm32::dma::NoDma;
use embassy_stm32::usart::{Config, Uart};
@@ -34,14 +33,6 @@ async fn main_task() {
}
}
-struct ZeroClock;
-
-impl Clock for ZeroClock {
- fn now(&self) -> u64 {
- 0
- }
-}
-
static EXECUTOR: Forever<Executor> = Forever::new();
#[entry]
@@ -52,8 +43,6 @@ fn main() -> ! {
Dbgmcu::enable_all();
}
- unsafe { embassy::time::set_clock(&ZeroClock) };
-
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
diff --git a/examples/stm32h7/src/bin/usart_dma.rs b/examples/stm32h7/src/bin/usart_dma.rs
index 26cc3c5d..3f70a82b 100644
--- a/examples/stm32h7/src/bin/usart_dma.rs
+++ b/examples/stm32h7/src/bin/usart_dma.rs
@@ -8,7 +8,6 @@
mod example_common;
use core::fmt::Write;
use embassy::executor::Executor;
-use embassy::time::Clock;
use embassy::util::Forever;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;
@@ -36,14 +35,6 @@ async fn main_task() {
}
}
-struct ZeroClock;
-
-impl Clock for ZeroClock {
- fn now(&self) -> u64 {
- 0
- }
-}
-
static EXECUTOR: Forever<Executor> = Forever::new();
#[entry]
@@ -54,8 +45,6 @@ fn main() -> ! {
Dbgmcu::enable_all();
}
- unsafe { embassy::time::set_clock(&ZeroClock) };
-
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
diff --git a/examples/stm32l0/src/bin/blinky.rs b/examples/stm32l0/src/bin/blinky.rs
index 27060edc..faa42896 100644
--- a/examples/stm32l0/src/bin/blinky.rs
+++ b/examples/stm32l0/src/bin/blinky.rs
@@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
diff --git a/examples/stm32l0/src/bin/button_exti.rs b/examples/stm32l0/src/bin/button_exti.rs
index 9f0b0bde..40e25b08 100644
--- a/examples/stm32l0/src/bin/button_exti.rs
+++ b/examples/stm32l0/src/bin/button_exti.rs
@@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::exti::ExtiInput;
use embassy_stm32::gpio::{Input, Pull};
diff --git a/examples/stm32l0/src/bin/usart_dma.rs b/examples/stm32l0/src/bin/usart_dma.rs
index 2c0690d0..39a60517 100644
--- a/examples/stm32l0/src/bin/usart_dma.rs
+++ b/examples/stm32l0/src/bin/usart_dma.rs
@@ -9,7 +9,6 @@ mod example_common;
use example_common::*;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::usart::{Config, Uart};
use embassy_stm32::{rcc, Peripherals};
diff --git a/examples/stm32l4/src/bin/blinky.rs b/examples/stm32l4/src/bin/blinky.rs
index c929335d..fc86b11e 100644
--- a/examples/stm32l4/src/bin/blinky.rs
+++ b/examples/stm32l4/src/bin/blinky.rs
@@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::dbgmcu::Dbgmcu;
diff --git a/examples/stm32l4/src/bin/button_exti.rs b/examples/stm32l4/src/bin/button_exti.rs
index a702b5ba..8a78b258 100644
--- a/examples/stm32l4/src/bin/button_exti.rs
+++ b/examples/stm32l4/src/bin/button_exti.rs
@@ -6,7 +6,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::exti::ExtiInput;
diff --git a/examples/stm32l4/src/bin/spi_dma.rs b/examples/stm32l4/src/bin/spi_dma.rs
index aa076258..ba77331b 100644
--- a/examples/stm32l4/src/bin/spi_dma.rs
+++ b/examples/stm32l4/src/bin/spi_dma.rs
@@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
diff --git a/examples/stm32l4/src/bin/usart_dma.rs b/examples/stm32l4/src/bin/usart_dma.rs
index b15bba76..f74a0e06 100644
--- a/examples/stm32l4/src/bin/usart_dma.rs
+++ b/examples/stm32l4/src/bin/usart_dma.rs
@@ -7,7 +7,6 @@
#[path = "../example_common.rs"]
mod example_common;
use core::fmt::Write;
-use defmt::panic;
use embassy::executor::Spawner;
use embassy_stm32::dbgmcu::Dbgmcu;
use embassy_stm32::dma::NoDma;