aboutsummaryrefslogtreecommitdiff
path: root/examples/src/bin/blinky.rs
diff options
context:
space:
mode:
authorFelipe Balbi <[email protected]>2025-11-19 09:11:54 -0800
committerGitHub <[email protected]>2025-11-19 09:11:54 -0800
commita8eb124e47e633cd81e0863253d5f6bdd7545260 (patch)
tree526374336411093886915121fea7245efa067c93 /examples/src/bin/blinky.rs
parentffe3e5acae6c0038db4176dc7d031b57f865e07f (diff)
OSTimer updates (#24)
* Initialize OSTIMER0 during HAL initialization Provide the user with a working time driver. Signed-off-by: Felipe Balbi <[email protected]> * Handle time_driver interrupt internally Signed-off-by: Felipe Balbi <[email protected]> * Gate `time-driver` impl behind a `time` flag Also prevents creation of an `Ostimer` instance if the `time` feature is active. * Remove some dead code --------- Signed-off-by: Felipe Balbi <[email protected]> Co-authored-by: James Munns <[email protected]>
Diffstat (limited to 'examples/src/bin/blinky.rs')
-rw-r--r--examples/src/bin/blinky.rs13
1 files changed, 0 insertions, 13 deletions
diff --git a/examples/src/bin/blinky.rs b/examples/src/bin/blinky.rs
index 28d83a12e..ab1e59bdb 100644
--- a/examples/src/bin/blinky.rs
+++ b/examples/src/bin/blinky.rs
@@ -2,29 +2,16 @@
2#![no_main] 2#![no_main]
3 3
4use embassy_executor::Spawner; 4use embassy_executor::Spawner;
5use embassy_mcxa::bind_interrupts;
6use embassy_time::Timer; 5use embassy_time::Timer;
7use hal::gpio::{Level, Output}; 6use hal::gpio::{Level, Output};
8use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; 7use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _};
9 8
10// Bind only OS_EVENT for timer interrupts
11bind_interrupts!(struct Irqs {
12 OS_EVENT => hal::ostimer::time_driver::OsEventHandler;
13});
14
15#[used]
16#[no_mangle]
17static KEEP_OS_EVENT: unsafe extern "C" fn() = OS_EVENT;
18
19#[embassy_executor::main] 9#[embassy_executor::main]
20async fn main(_spawner: Spawner) { 10async fn main(_spawner: Spawner) {
21 let p = hal::init(hal::config::Config::default()); 11 let p = hal::init(hal::config::Config::default());
22 12
23 defmt::info!("Blink example"); 13 defmt::info!("Blink example");
24 14
25 // Initialize embassy-time global driver backed by OSTIMER0
26 hal::ostimer::time_driver::init(hal::config::Config::default().time_interrupt_priority, 1_000_000);
27
28 let mut red = Output::new(p.P3_18, Level::High); 15 let mut red = Output::new(p.P3_18, Level::High);
29 let mut green = Output::new(p.P3_19, Level::High); 16 let mut green = Output::new(p.P3_19, Level::High);
30 let mut blue = Output::new(p.P3_21, Level::High); 17 let mut blue = Output::new(p.P3_21, Level::High);