pros/rtos.h file

Contains declarations for the PROS RTOS kernel for use by typical VEX programmers.

This file should not be modified by users, since it gets replaced whenever a kernel upgrade occurs.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Namespaces

namespace pros
LLEMU Conditional Include
namespace pros::c

Functions

uint32_t millis(void)
Gets the number of milliseconds since PROS initialized.
uint64_t micros(void)
Gets the number of microseconds since PROS initialized,.
task_t task_create(task_fn_t function, void*const parameters, uint32_t prio, const uint16_t stack_depth, const char*const name)
Creates a new task and add it to the list of tasks that are ready to run.
void task_delete(task_t task)
Removes a task from the RTOS real time kernel's management.
void task_delay(const uint32_t milliseconds)
Delays the current task for a given number of milliseconds.
void delay(const uint32_t milliseconds)
Delays the current task for a given number of milliseconds.
void task_delay_until(uint32_t*const prev_time, const uint32_t delta)
Delays the current task until a specified time.
uint32_t task_get_priority(task_t task)
Gets the priority of the specified task.
void task_set_priority(task_t task, uint32_t prio)
Sets the priority of the specified task.
task_state_e_t task_get_state(task_t task)
Gets the state of the specified task.
void task_suspend(task_t task)
Suspends the specified task, making it ineligible to be scheduled.
void task_resume(task_t task)
Resumes the specified task, making it eligible to be scheduled.
uint32_t task_get_count(void)
Gets the number of tasks the kernel is currently managing, including all ready, blocked, or suspended tasks.
char* task_get_name(task_t task)
Gets the name of the specified task.
task_t task_get_by_name(const char* name)
Gets a task handle from the specified name.
task_t task_get_current()
Get the currently running task handle.
uint32_t task_notify(task_t task)
Sends a simple notification to task and increments the notification counter.
void task_join(task_t task)
Utilizes task notifications to wait until specified task is complete and deleted, then continues to execute the program.
uint32_t task_notify_ext(task_t task, uint32_t value, notify_action_e_t action, uint32_t* prev_value)
Sends a notification to a task, optionally performing some action.
uint32_t task_notify_take(bool clear_on_exit, uint32_t timeout)
Waits for a notification to be nonzero.
bool task_notify_clear(task_t task)
Clears the notification for a task.
mutex_t mutex_create(void)
Creates a mutex.
bool mutex_take(mutex_t mutex, uint32_t timeout)
Takes and locks a mutex, waiting for up to a certain number of milliseconds before timing out.
bool mutex_give(mutex_t mutex)
Unlocks a mutex.
void mutex_delete(mutex_t mutex)
Deletes a mutex.

Macros

#define TASK_PRIORITY_MAX
The highest priority that can be assigned to a task.
#define TASK_PRIORITY_MIN
The lowest priority that can be assigned to a task.
#define TASK_PRIORITY_DEFAULT
The default task priority, which should be used for most tasks unless you have a specific need for a higher or lower priority task.
#define TASK_STACK_DEPTH_DEFAULT
The recommended stack size for a new task.
#define TASK_STACK_DEPTH_MIN
The minimal stack size for a task.
#define TASK_NAME_MAX_LEN
The maximum number of characters allowed in a task's name.
#define TIMEOUT_MAX
The maximum timeout value that can be given to, for instance, a mutex grab.

Typedefs

using task_t = void*
An opaque type that pontis to a task handle.
using task_fn_t = void(*)(void*)
A pointer to a task's function.
using mutex_t = void*
A mutex..

Enumerations

enum task_state_e_t { E_TASK_STATE_RUNNING = 0, E_TASK_STATE_READY, E_TASK_STATE_BLOCKED, E_TASK_STATE_SUSPENDED, E_TASK_STATE_DELETED, E_TASK_STATE_INVALID }
The state of a task.
enum notify_action_e_t { E_NOTIFY_ACTION_NONE, E_NOTIFY_ACTION_BITS, E_NOTIFY_ACTION_INCR, E_NOTIFY_ACTION_OWRITE, E_NOTIFY_ACTION_NO_OWRITE }
brief The action to take when a task is notified.

Defines

#define CURRENT_TASK
The task handle of the currently running task.