mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 04:45:19 +01:00
rtic-monotonics: Simplify features, default is 1kHz
Make 100 Hz or 10 kHz opt in through features, which are meant for testing primarily.
This commit is contained in:
parent
ace010f4e9
commit
858160a55d
4 changed files with 18 additions and 13 deletions
|
|
@ -8,16 +8,23 @@ use cortex_m::peripheral::SYST;
|
|||
use embedded_hal_async::delay::DelayUs;
|
||||
pub use fugit::ExtU32;
|
||||
|
||||
#[cfg(feature = "systick_100hz")]
|
||||
const TIMER_HZ: u32 = 100;
|
||||
// Features should be additive, here systick_100hz gets picked if both
|
||||
// `systick_100hz` and `systick_10khz` are enabled.
|
||||
|
||||
#[cfg(feature = "systick_1khz")]
|
||||
const TIMER_HZ: u32 = 1_000;
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "systick_100hz")]
|
||||
{
|
||||
const TIMER_HZ: u32 = 100;
|
||||
} else if #[cfg(feature = "systick_10khz")]
|
||||
{
|
||||
const TIMER_HZ: u32 = 10_000;
|
||||
} else {
|
||||
// Default case is 1 kHz
|
||||
const TIMER_HZ: u32 = 1_000;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "systick_10khz")]
|
||||
const TIMER_HZ: u32 = 10_000;
|
||||
|
||||
/// Systick implementing `rtic_monotonic::Monotonic` which runs at 1 kHz.
|
||||
/// Systick implementing `rtic_monotonic::Monotonic` which runs at 1 kHz, 100Hz or 10 kHz.
|
||||
pub struct Systick;
|
||||
|
||||
impl Systick {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue