vex_sdk/task.rs
1//! VEXos Task Scheduler Functions
2
3use crate::map_jump_table;
4
5use core::ffi::{c_char, c_int, c_void};
6
7map_jump_table! {
8 0x028 =>
9 /// Creates an RTOS task
10 ///
11 /// Derived from <https://github.com/jpearman/vexcode-lvgllib6_X/blob/8ead3dab49665d4c98225d612672be28c7c2a425/src/v5lvgl.c#L17>
12 pub fn vexTaskAdd(
13 callback: unsafe extern "C" fn() -> c_int,
14 interval: c_int,
15 label: *const c_char
16 ),
17 0x084 =>
18 /// Gets a tasks's callback function and internal ID.
19 ///
20 /// Derived from <https://github.com/jpearman/V5_CompetitionTest/blob/efb7214b983d30d5583e39b343161c26d7187766/include/comp_debug.h#L41>
21 pub fn vexTaskGetCallbackAndId(
22 index: u32,
23 callback_id: *mut c_int,
24 ) -> *mut c_void,
25 0x06c =>
26 /// Sets the current task to sleep for the specified amount of time (in milliseconds).
27 ///
28 /// Derived from <https://github.com/jpearman/vexcode-lvgllib6_X/blob/8ead3dab49665d4c98225d612672be28c7c2a425/src/v5lvgl.c#L18>
29 pub fn vexTaskSleep(time: u32),
30 0xf74 => pub fn vexBackgroundProcessing(),
31 0x05c =>
32 /// Ticks the CPU1 Scheduler
33 ///
34 /// This function is responsible for running VEXos tasks on CPU1. It must be called by
35 /// the runtime ideally every 2mS to allow for internal OS tasks on the user processor
36 /// to run. The scheduler is entirely cooperative, so the runtime must ensure that the CPU
37 /// gets time to regularly execute these tasks.
38 ///
39 /// VEXos has several background tasks in its scheduler responsible for handling transactions
40 /// between CPU1 and CPU0, including tasks for handling device reads, serial flushing, USB,
41 /// and other important operations that must occur in the background alongside user code.
42 pub fn vexTasksRun(),
43}