You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
378 B
20 lines
378 B
use bcm2837::timer::{BasicTimer, Timer};
|
|
use log::*;
|
|
|
|
/// Initialization timer.
|
|
pub fn init() {
|
|
Timer::new().init();
|
|
set_next();
|
|
info!("timer: init end");
|
|
}
|
|
|
|
/// Returns the current time in microseconds.
|
|
pub fn get_cycle() -> u64 {
|
|
Timer::new().read()
|
|
}
|
|
|
|
/// Set next timer interrupt to 10 ms from now.
|
|
pub fn set_next() {
|
|
Timer::new().tick_in(10 * 1000);
|
|
}
|