aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840_blinky/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nrf52840_blinky/src/bin')
-rw-r--r--examples/nrf52840_blinky/src/bin/blinky_rtc.rs10
-rw-r--r--examples/nrf52840_blinky/src/bin/blinky_timer.rs10
2 files changed, 8 insertions, 12 deletions
diff --git a/examples/nrf52840_blinky/src/bin/blinky_rtc.rs b/examples/nrf52840_blinky/src/bin/blinky_rtc.rs
index dbdd0b0..fa654b8 100644
--- a/examples/nrf52840_blinky/src/bin/blinky_rtc.rs
+++ b/examples/nrf52840_blinky/src/bin/blinky_rtc.rs
@@ -5,6 +5,9 @@
use nrf52840_blinky::hal;
+use rtic_monotonics::nrf::rtc::prelude::*;
+nrf_rtc0_monotonic!(Mono);
+
#[rtic::app(device = hal::pac, dispatchers = [SWI0_EGU0])]
mod app {
use super::*;
@@ -12,10 +15,6 @@ mod app {
use hal::gpio::{Level, Output, Pin, PushPull};
use hal::prelude::*;
- use rtic_monotonics::nrf::rtc::Rtc0 as Mono;
- use rtic_monotonics::nrf::rtc::*;
- use rtic_monotonics::Monotonic;
-
#[shared]
struct Shared {}
@@ -30,8 +29,7 @@ mod app {
hal::clocks::Clocks::new(cx.device.CLOCK).start_lfclk();
// Initialize Monotonic
- let token = rtic_monotonics::create_nrf_rtc0_monotonic_token!();
- Mono::start(cx.device.RTC0, token);
+ Mono::start(cx.device.RTC0);
// Setup LED
let port0 = hal::gpio::p0::Parts::new(cx.device.P0);
diff --git a/examples/nrf52840_blinky/src/bin/blinky_timer.rs b/examples/nrf52840_blinky/src/bin/blinky_timer.rs
index c1342f4..ebb20fc 100644
--- a/examples/nrf52840_blinky/src/bin/blinky_timer.rs
+++ b/examples/nrf52840_blinky/src/bin/blinky_timer.rs
@@ -5,6 +5,9 @@
use nrf52840_blinky::hal;
+use rtic_monotonics::nrf::timer::prelude::*;
+nrf_timer0_monotonic!(Mono, 8_000_000);
+
#[rtic::app(device = hal::pac, dispatchers = [SWI0_EGU0])]
mod app {
use super::*;
@@ -12,10 +15,6 @@ mod app {
use hal::gpio::{Level, Output, Pin, PushPull};
use hal::prelude::*;
- use rtic_monotonics::nrf::timer::Timer0 as Mono;
- use rtic_monotonics::nrf::timer::*;
- use rtic_monotonics::Monotonic;
-
#[shared]
struct Shared {}
@@ -27,8 +26,7 @@ mod app {
#[init]
fn init(cx: init::Context) -> (Shared, Local) {
// Initialize Monotonic
- let token = rtic_monotonics::create_nrf_timer0_monotonic_token!();
- Mono::start(cx.device.TIMER0, token);
+ Mono::start(cx.device.TIMER0);
// Setup LED
let port0 = hal::gpio::p0::Parts::new(cx.device.P0);