mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-30 15:34:33 +01:00
Removed monotonic trait, moved to rtic-core
This commit is contained in:
parent
e65a86f696
commit
3b4c10e790
1 changed files with 0 additions and 44 deletions
44
src/lib.rs
44
src/lib.rs
|
@ -108,50 +108,6 @@ impl From<cortex_m::Peripherals> for Peripherals {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fraction
|
||||
pub struct Fraction {
|
||||
/// The numerator
|
||||
pub numerator: u32,
|
||||
|
||||
/// The denominator
|
||||
pub denominator: u32,
|
||||
}
|
||||
|
||||
/// A monotonic clock / counter
|
||||
pub trait Monotonic {
|
||||
/// A measurement of this clock, use `CYCCNT` as a reference implementation for `Instant`.
|
||||
/// Note that the Instant must be a signed value such as `i32`.
|
||||
type Instant: Copy + Ord + Sub;
|
||||
|
||||
/// The ratio between the system timer (SysTick) frequency and this clock frequency, i.e.
|
||||
/// `Monotonic clock * Fraction = System clock`
|
||||
///
|
||||
/// The ratio must be expressed in *reduced* `Fraction` form to prevent overflows. That is
|
||||
/// `2 / 3` instead of `4 / 6`
|
||||
fn ratio() -> Fraction;
|
||||
|
||||
/// Returns the current time
|
||||
///
|
||||
/// # Correctness
|
||||
///
|
||||
/// This function is *allowed* to return nonsensical values if called before `reset` is invoked
|
||||
/// by the runtime. Therefore application authors should *not* call this function during the
|
||||
/// `#[init]` phase.
|
||||
fn now() -> Self::Instant;
|
||||
|
||||
/// Resets the counter to *zero*
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function will be called *exactly once* by the RTIC runtime after `#[init]` returns and
|
||||
/// before tasks can start; this is also the case in multi-core applications. User code must
|
||||
/// *never* call this function.
|
||||
unsafe fn reset();
|
||||
|
||||
/// A `Self::Instant` that represents a count of *zero*
|
||||
fn zero() -> Self::Instant;
|
||||
}
|
||||
|
||||
/// Sets the given `interrupt` as pending
|
||||
///
|
||||
/// This is a convenience function around
|
||||
|
|
Loading…
Reference in a new issue