aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840_blinky
diff options
context:
space:
mode:
authorFinomnis <Finomnis@users.noreply.github.com>2024-04-11 00:00:38 +0200
committerGitHub <noreply@github.com>2024-04-10 22:00:38 +0000
commit8c23e178f3838bcdd13662a2ffefd39ec144e869 (patch)
treef2d2cefcd6bb2876e74ee6035b5489a4a2d9590f /examples/nrf52840_blinky
parente4cc5fd17b8a2df332af0ee25c8bd7092e66afb0 (diff)
Monotonic rewrite (#874)
* Rework timer_queue and monotonic architecture Goals: * make Monotonic purely internal * make Monotonic purely tick passed, no fugit involved * create a wrapper struct in the user's code via a macro that then converts the "now" from the tick based monotonic to a fugit based timestamp We need to proxy the delay functions of the timer queue anyway, so we could simply perform the conversion in those proxy functions. * Update cargo.lock * Update readme of rtic-time * CI: ESP32: Redact esp_image: Too volatile * Fixup: Changelog double entry rebase mistake --------- Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'examples/nrf52840_blinky')
-rw-r--r--examples/nrf52840_blinky/Cargo.lock40
-rw-r--r--examples/nrf52840_blinky/Cargo.toml2
-rw-r--r--examples/nrf52840_blinky/src/bin/blinky_rtc.rs10
-rw-r--r--examples/nrf52840_blinky/src/bin/blinky_timer.rs10
4 files changed, 35 insertions, 27 deletions
diff --git a/examples/nrf52840_blinky/Cargo.lock b/examples/nrf52840_blinky/Cargo.lock
index a3d7542..ec5f4f9 100644
--- a/examples/nrf52840_blinky/Cargo.lock
+++ b/examples/nrf52840_blinky/Cargo.lock
@@ -136,7 +136,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.51",
]
[[package]]
@@ -179,9 +179,18 @@ dependencies = [
[[package]]
name = "embedded-hal"
-version = "1.0.0-rc.2"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
+
+[[package]]
+name = "embedded-hal-async"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e57ec6ad0bc8eb967cf9c9f144177f5e8f2f6f02dad0b8b683f9f05f6b22def"
+checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884"
+dependencies = [
+ "embedded-hal 1.0.0",
+]
[[package]]
name = "embedded-storage"
@@ -412,18 +421,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.70"
+version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
+checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.33"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@@ -468,18 +477,18 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.51",
]
[[package]]
name = "rtic-monotonics"
-version = "1.4.0"
+version = "2.0.0"
dependencies = [
"atomic-polyfill",
"cfg-if",
"cortex-m",
"critical-section",
- "embedded-hal 1.0.0-rc.2",
+ "embedded-hal 1.0.0",
"fugit",
"nrf52840-pac",
"rtic-time",
@@ -487,9 +496,12 @@ dependencies = [
[[package]]
name = "rtic-time"
-version = "1.1.0"
+version = "2.0.0"
dependencies = [
"critical-section",
+ "embedded-hal 1.0.0",
+ "embedded-hal-async",
+ "fugit",
"futures-util",
"rtic-common",
]
@@ -537,9 +549,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.39"
+version = "2.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
+checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c"
dependencies = [
"proc-macro2",
"quote",
@@ -563,7 +575,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.51",
]
[[package]]
diff --git a/examples/nrf52840_blinky/Cargo.toml b/examples/nrf52840_blinky/Cargo.toml
index 8b13649..5569019 100644
--- a/examples/nrf52840_blinky/Cargo.toml
+++ b/examples/nrf52840_blinky/Cargo.toml
@@ -26,7 +26,7 @@ features = ["thumbv7-backend"]
[dependencies.rtic-monotonics]
path = "../../rtic-monotonics"
-version = "1.4.0"
+version = "2.0.0"
features = ["nrf52840"]
# cargo build/run
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);