Go to the source code of this file.
Macros | |
| #define | VALIDATE_PORT_NO(PORT) |
| #define | VALIDATE_PORT_NO_INTERNAL(PORT) |
| #define | claim_port(port, device_type, error_code) |
| #define | claim_port_i(port, device_type) |
| #define | claim_port_f(port, device_type) |
| #define | return_port(port, rtn) |
| #define | V5_PORT_BATTERY 24 |
| #define | V5_PORT_CONTROLLER_1 25 |
| #define | V5_PORT_CONTROLLER_2 26 |
Functions | |
| int32_t | claim_port_try (uint8_t port, v5_device_e_t type) |
| void | vdml_set_port_error (uint8_t port) |
| void | vdml_unset_port_error (uint8_t port) |
| bool | vdml_get_port_error (uint8_t port) |
| int | port_mutex_take (uint8_t port) |
| int | port_mutex_give (uint8_t port) |
| void | port_mutex_take_all () |
| void | port_mutex_give_all () |
| int | internal_port_mutex_take (uint8_t port) |
| int | internal_port_mutex_give (uint8_t port) |
Variables | |
| int32_t | port_errors |
This file contains all types and functions used throughout multiple VDML (Vex Data Management Layer) files.
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/.
| #define claim_port | ( | port, | |
| device_type, | |||
| error_code ) |
Macro that handles error checking, sanity checking, automatic registration, and mutex taking for all of the motor wrapper functions. If port is out of range, the calling function sets errno and returns. If a port isn't yet registered, it registered as a motor automatically. If a mutex cannot be taken, errno is set to EACCES (access denied) and returns.
| port | The V5 port number from 0-20 |
| device_type | The v5_device_e_t that the port is configured as |
| error_code | The error code that return if error checking failed |
| #define claim_port_f | ( | port, | |
| device_type ) |
Function like claim_port. This macro should only be used in functions that return double or float as PROS_ERR_F could be returned.
| port | The V5 port number from 0-20 |
| device_type | The v5_device_e_t that the port is configured as |
| #define claim_port_i | ( | port, | |
| device_type ) |
Function like claim_port. This macro should only be used in functions that return int32_t or enums as PROS_ERR could be returned.
| port | The V5 port number from 0-20 |
| device_type | The v5_device_e_t that the port is configured as |
| #define return_port | ( | port, | |
| rtn ) |
Macro that release the mutex for the given port and sets errno to 0 if the function is an accessor wrapper whos return value is PROS_ERR or PROS_ERR_F.
| port | The V5 port number from 0-20 |
| rtn | The desired return value |
| #define VALIDATE_PORT_NO | ( | PORT | ) |
Macro, returns true if the port is in range of user configurable ports, false otherwise.
| #define VALIDATE_PORT_NO_INTERNAL | ( | PORT | ) |
| int32_t claim_port_try | ( | uint8_t | port, |
| v5_device_e_t | type ) |
A function that executes claim_port and allows you to execute a block of code if an error occurs.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). EACCES - Another resource is currently trying to access the port.
| port | The V5 port number from 0-20 |
| device_type | The v5_device_e_t that the port is configured as |
| int internal_port_mutex_give | ( | uint8_t | port | ) |
Returns a port mutex with bounds checking for V5_MAX_PORTS (32) not user exposed device ports (20). Intended for internal usage for protecting thread-safety on devices such as the controller and battery
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (0-32).
| port | The V5 port number from 0-32 |
| int internal_port_mutex_take | ( | uint8_t | port | ) |
Obtains a port mutex with bounds checking for V5_MAX_PORTS (32) not user exposed device ports (20). Intended for internal usage for protecting thread-safety on devices such as the controller and battery
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (0-32).
| port | The V5 port number from 0-32 |
| int port_mutex_give | ( | uint8_t | port | ) |
Returns the mutex for the given port.
Frees the mutex for this port, allowing other tasks to continue.
WARNING: If a mutex was claimed by a task, this MUST be called immediately after the port is no longer needed by that task in order to prevent delays in other tasks.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (0-20).
| port | The V5 port number to free from 0-20 |
| void port_mutex_give_all | ( | ) |
Executes port_mutex_give() for all of the V5 Smart Ports.
| int port_mutex_take | ( | uint8_t | port | ) |
Claims the mutex for the given port.
Reserves the mutex for this port. Any other tasks trying to access this port will block until the mutex is returned. If a higher-priortiy task attempts to claim this port, the task which has the port claimed will temporarily be raised to an equal priority until the mutex is given, reducing the impact of the delay. See FreeRTOS documentation for more details.
This MUST be called before any call to the v5 api to maintain thread saftey.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (0-20).
| port | The V5 port number to claim from 0-20 |
| void port_mutex_take_all | ( | ) |
Executes port_mutex_take() for all of the V5 Smart Ports.
| bool vdml_get_port_error | ( | uint8_t | port | ) |
Gets the error bit for the port, indicating whether or not there has been an error on this port.
| port | The V5 port number to check from 0-20 |
| void vdml_set_port_error | ( | uint8_t | port | ) |
Sets the port's bit to 1, indicating there has already been an error on this port.
| port | The V5 port number to set from 0-20 |
| void vdml_unset_port_error | ( | uint8_t | port | ) |
Sets the port's bit to 0, effectively resetting it.
| port | The V5 port number to unset from 0-20 |
|
extern |
Bitmap to indicate if a port has had an error printed or not.