From 3b4c10e790e63ac328a7bdb98451ac11d5935731 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 26 Nov 2020 18:07:22 +0100 Subject: Removed monotonic trait, moved to rtic-core --- src/lib.rs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index f1fb550..385b5ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -108,50 +108,6 @@ impl From 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 -- cgit v1.2.3 From ef50aeb2e8245b69843280fabb62589c0716ffdd Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 3 Dec 2020 21:04:06 +0100 Subject: Save, init generation fixed --- src/lib.rs | 68 +++----------------------------------------------------------- 1 file changed, 3 insertions(+), 65 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 385b5ea..c1930b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,82 +32,20 @@ #![deny(missing_docs)] #![deny(rust_2018_compatibility)] #![deny(rust_2018_idioms)] -#![deny(warnings)] +// #![deny(warnings)] #![no_std] use core::ops::Sub; -use cortex_m::{ - interrupt::Nr, - peripheral::{CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, TPIU}, -}; +use cortex_m::{interrupt::Nr, peripheral::NVIC}; pub use cortex_m_rtic_macros::app; -pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex}; +pub use rtic_core::{prelude as mutex_prelude, Exclusive, monotonic::Monotonic, Mutex}; -#[cfg(armv7m)] -pub mod cyccnt; #[doc(hidden)] pub mod export; #[doc(hidden)] mod tq; -/// `cortex_m::Peripherals` minus `SYST` -#[allow(non_snake_case)] -pub struct Peripherals { - /// Cache and branch predictor maintenance operations (not present on Cortex-M0 variants) - pub CBP: CBP, - - /// CPUID - pub CPUID: CPUID, - - /// Debug Control Block - pub DCB: DCB, - - /// Data Watchpoint and Trace unit - pub DWT: DWT, - - /// Flash Patch and Breakpoint unit (not present on Cortex-M0 variants) - pub FPB: FPB, - - /// Floating Point Unit (only present on `thumbv7em-none-eabihf`) - pub FPU: FPU, - - /// Instrumentation Trace Macrocell (not present on Cortex-M0 variants) - pub ITM: ITM, - - /// Memory Protection Unit - pub MPU: MPU, - - /// Nested Vector Interrupt Controller - pub NVIC: NVIC, - - /// System Control Block - pub SCB: SCB, - - // SysTick: System Timer - // pub SYST: SYST, - /// Trace Port Interface Unit (not present on Cortex-M0 variants) - pub TPIU: TPIU, -} - -impl From for Peripherals { - fn from(p: cortex_m::Peripherals) -> Self { - Self { - CBP: p.CBP, - CPUID: p.CPUID, - DCB: p.DCB, - DWT: p.DWT, - FPB: p.FPB, - FPU: p.FPU, - ITM: p.ITM, - MPU: p.MPU, - NVIC: p.NVIC, - SCB: p.SCB, - TPIU: p.TPIU, - } - } -} - /// Sets the given `interrupt` as pending /// /// This is a convenience function around -- cgit v1.2.3 From 97a48983d2859740983cbf342e1287182426ed44 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 10 Dec 2020 20:33:13 +0100 Subject: More work --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index c1930b0..ade1267 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,7 +39,10 @@ use core::ops::Sub; use cortex_m::{interrupt::Nr, peripheral::NVIC}; pub use cortex_m_rtic_macros::app; -pub use rtic_core::{prelude as mutex_prelude, Exclusive, monotonic::Monotonic, Mutex}; +pub use rtic_core::{ + monotonic::{Clock, Instant, Monotonic}, + prelude as mutex_prelude, Exclusive, Mutex, +}; #[doc(hidden)] pub mod export; -- cgit v1.2.3 From 8e8ec9b7b879adae8d4de6cb2320b9b19290a7e0 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sat, 12 Dec 2020 23:24:54 +0100 Subject: Monotonic codegen now passing compile stage --- src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index ade1267..c85090f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,12 +35,10 @@ // #![deny(warnings)] #![no_std] -use core::ops::Sub; - use cortex_m::{interrupt::Nr, peripheral::NVIC}; pub use cortex_m_rtic_macros::app; pub use rtic_core::{ - monotonic::{Clock, Instant, Monotonic}, + monotonic::{self, Clock, Duration, Instant, Monotonic}, prelude as mutex_prelude, Exclusive, Mutex, }; -- cgit v1.2.3 From 35b4ec0d0435879cca97536b5c866fc2ac2e9210 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sun, 13 Dec 2020 00:06:50 +0100 Subject: Reexport embedded-time as rtic::time --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index c85090f..0840589 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ use cortex_m::{interrupt::Nr, peripheral::NVIC}; pub use cortex_m_rtic_macros::app; pub use rtic_core::{ - monotonic::{self, Clock, Duration, Instant, Monotonic}, + monotonic::{self, embedded_time as time, Monotonic}, prelude as mutex_prelude, Exclusive, Mutex, }; -- cgit v1.2.3 From ebf2f058a4d2a1fcf118144b9893dc3038939bad Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 18 Feb 2021 19:30:59 +0100 Subject: Now with new monotonic trait and crate --- src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 1d4df65..16f2e9f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,10 +37,8 @@ use cortex_m::{interrupt::InterruptNumber, peripheral::NVIC}; pub use cortex_m_rtic_macros::app; -pub use rtic_core::{ - monotonic::{self, embedded_time as time, Monotonic}, - prelude as mutex_prelude, Exclusive, Mutex, -}; +pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex}; +pub use rtic_monotonic::{self, embedded_time as time, Monotonic}; #[doc(hidden)] pub mod export; -- cgit v1.2.3 From 767d46e05bbc88eb3c236cf468f9432c7fe0ce05 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 25 Feb 2021 17:32:12 +0100 Subject: Review fixes --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 16f2e9f..8220739 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ #![deny(missing_docs)] #![deny(rust_2018_compatibility)] #![deny(rust_2018_idioms)] -// #![deny(warnings)] +#![deny(warnings)] #![no_std] use cortex_m::{interrupt::InterruptNumber, peripheral::NVIC}; -- cgit v1.2.3