#RusPiRo #baremetal #raspberrypi #timer

nightly no-std ruspiro-timer

This crates provides simple timing functions to pause the current core for a specific amount of time

5 releases (3 breaking)

0.4.1 Sep 12, 2020
0.4.0 Jan 25, 2020
0.3.0 Dec 14, 2019
0.1.0 Aug 4, 2019
0.0.1 Aug 1, 2019

#6 in #baremetal

Download history 8/week @ 2020-05-30 10/week @ 2020-06-06 10/week @ 2020-06-13 3/week @ 2020-06-20 5/week @ 2020-06-27 10/week @ 2020-07-04 8/week @ 2020-07-11 15/week @ 2020-07-18 8/week @ 2020-07-25 1/week @ 2020-08-01 33/week @ 2020-08-08 13/week @ 2020-08-15 19/week @ 2020-08-22 26/week @ 2020-08-29 37/week @ 2020-09-05 67/week @ 2020-09-12

62 downloads per month
Used in 4 crates

Apache-2.0

21KB
200 lines

Timer RusPiRo crate

This crate provides simple functions to pause execution on the current core for a given amount of time. It uses the free-running counter of the Raspberry Pi to provide micro second accurate pause timings.

Travis-CI Status Latest Version Documentation License

Features

Feature Description
ruspiro_pi3 active to use the proper timer MMIO base memory address for Raspberry Pi 3 when accessing the system timer peripheral

Usage

To use the crate just add the following dependency to your Cargo.toml file:

[dependencies]
ruspiro-timer = "0.4"

Once done the access to the timer functions is available in your rust files like so:

use rusprio_timer:*;

fn foo() {
    sleep(Useconds(1_000)); // pause for 1 millisecond
    sleepcycles(200); // pause for 200 CPU cycles
}

Scheduling the execution of a function/closure is as simple as this:

use ruspiro_timer::*;

fn foo() {
    schedule(Mseconds(100), || println!("delayed execution")); // print after 100 milliseconds
}

License

Licensed under Apache License, Version 2.0, (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)

Dependencies

~1.5MB
~40K SLoC