aboutsummaryrefslogtreecommitdiff
path: root/rtic-timer/src/monotonic.rs
diff options
context:
space:
mode:
authorEmil Fresk <emil.fresk@gmail.com>2023-01-23 20:57:56 +0100
committerHenrik Tjäder <henrik@tjaders.com>2023-03-01 00:33:31 +0100
commit71b5f9438e1beb5fe12b90415d9d6307e79c0cdf (patch)
treed355da4f316ef5162916d99aebe9aa3a47ca7909 /rtic-timer/src/monotonic.rs
parent0f6ae7c1dd0ce10a83682a922bf68aca9121df1c (diff)
Fixed systick monotonic
Diffstat (limited to 'rtic-timer/src/monotonic.rs')
-rw-r--r--rtic-timer/src/monotonic.rs60
1 files changed, 0 insertions, 60 deletions
diff --git a/rtic-timer/src/monotonic.rs b/rtic-timer/src/monotonic.rs
deleted file mode 100644
index 9b3742f..0000000
--- a/rtic-timer/src/monotonic.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-//! ...
-
-/// # A monotonic clock / counter definition.
-///
-/// ## Correctness
-///
-/// The trait enforces that proper time-math is implemented between `Instant` and `Duration`. This
-/// is a requirement on the time library that the user chooses to use.
-pub trait Monotonic {
- /// The time at time zero.
- const ZERO: Self::Instant;
-
- /// The type for instant, defining an instant in time.
- ///
- /// **Note:** In all APIs in RTIC that use instants from this monotonic, this type will be used.
- type Instant: Ord
- + Copy
- + core::ops::Add<Self::Duration, Output = Self::Instant>
- + core::ops::Sub<Self::Duration, Output = Self::Instant>
- + core::ops::Sub<Self::Instant, Output = Self::Duration>;
-
- /// The type for duration, defining an duration of time.
- ///
- /// **Note:** In all APIs in RTIC that use duration from this monotonic, this type will be used.
- type Duration;
-
- /// Get the current time.
- fn now() -> Self::Instant;
-
- /// Set the compare value of the timer interrupt.
- ///
- /// **Note:** This method does not need to handle race conditions of the monotonic, the timer
- /// queue in RTIC checks this.
- fn set_compare(instant: Self::Instant);
-
- /// Clear the compare interrupt flag.
- fn clear_compare_flag();
-
- /// Pend the timer's interrupt.
- fn pend_interrupt();
-
- /// Optional. Runs on interrupt before any timer queue handling.
- fn on_interrupt() {}
-
- /// Optional. This is used to save power, this is called when the timer queue is not empty.
- ///
- /// Enabling and disabling the monotonic needs to propagate to `now` so that an instant
- /// based of `now()` is still valid.
- ///
- /// NOTE: This may be called more than once.
- fn enable_timer() {}
-
- /// Optional. This is used to save power, this is called when the timer queue is empty.
- ///
- /// Enabling and disabling the monotonic needs to propagate to `now` so that an instant
- /// based of `now()` is still valid.
- ///
- /// NOTE: This may be called more than once.
- fn disable_timer() {}
-}