Clock trait (#596)
* adds generic Env parameters * adds Clock type to Env * use new Clock * TockTimer improvements * new Clock interface * addressed comments * renames constants to milliseconds, other style fixes * removes all cargo fmt artifacts
This commit is contained in:
18
third_party/libtock-drivers/src/timer.rs
vendored
18
third_party/libtock-drivers/src/timer.rs
vendored
@@ -41,6 +41,24 @@ pub fn sleep(duration: Duration<isize>) -> TockResult<()> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ticks() -> TockResult<usize> {
|
||||
Ok(syscalls::command(
|
||||
DRIVER_NUMBER,
|
||||
command_nr::GET_CLOCK_VALUE,
|
||||
0,
|
||||
0,
|
||||
)?)
|
||||
}
|
||||
|
||||
pub fn get_clock_frequency() -> TockResult<usize> {
|
||||
Ok(syscalls::command(
|
||||
DRIVER_NUMBER,
|
||||
command_nr::GET_CLOCK_FREQUENCY,
|
||||
0,
|
||||
0,
|
||||
)?)
|
||||
}
|
||||
|
||||
pub fn with_callback<CB>(callback: CB) -> WithCallback<'static, CB> {
|
||||
WithCallback {
|
||||
callback,
|
||||
|
||||
Reference in New Issue
Block a user