2 unstable releases

0.2.0 Aug 8, 2021
0.1.0 Jun 23, 2020

#415 in Embedded development

Download history 5213/week @ 2024-11-30 5867/week @ 2024-12-07 5051/week @ 2024-12-14 2274/week @ 2024-12-21 2570/week @ 2024-12-28 5380/week @ 2025-01-04 5746/week @ 2025-01-11 5550/week @ 2025-01-18 10306/week @ 2025-01-25 8473/week @ 2025-02-01 7559/week @ 2025-02-08 9211/week @ 2025-02-15 16131/week @ 2025-02-22 19274/week @ 2025-03-01 20713/week @ 2025-03-08 14998/week @ 2025-03-15

73,019 downloads per month
Used in 25 crates (via madsim)

MIT license

7KB
58 lines

naive-timer

Crate Docs Actions Status Coverage Status

A minimal naive timer for embedded platforms in Rust (no_std + alloc).

Example

let mut timer = naive_timer::Timer::default();
let event = Arc::new(AtomicBool::new(false));

// add a timer with callback
timer.add(Duration::from_secs(1), {
    let event = event.clone();
    move |_now| event.store(true, Ordering::SeqCst)
});

// expire timers (usually from timer interrupt)
timer.expire(Duration::from_millis(1000));
assert_eq!(event.load(Ordering::SeqCst), true);
assert_eq!(timer.next(), None);

License

The code in this repository is licensed under the MIT License.

No runtime deps