safe_vex/rtos.rs
1//! The Real-Time OS API
2
3use crate::bindings;
4
5/// Gets the number of milliseconds since PROS initialized
6pub fn millis() -> u32 {
7 unsafe {
8 bindings::millis()
9 }
10}
11
12/// Gets the number of microseconds since PROS initialized
13pub fn micros() -> u64 {
14 unsafe {
15 bindings::micros()
16 }
17}
18
19/// Delays the current task for a given number of milliseconds
20pub fn task_delay(milliseconds: u32) {
21 unsafe {
22 bindings::task_delay(milliseconds);
23 }
24}
25
26/// Delays the current task until a specified time
27pub fn task_delay_until(prev_time: &mut u32, delta: u32) {
28 unsafe {
29 bindings::task_delay_until(prev_time as *mut u32, delta);
30 }
31}