ZestCode
 
Loading...
Searching...
No Matches
Miscellaneous C API

Files

file  misc.h
 

Classes

struct  date_s_t
 
struct  time_s_t
 

V5 Competition

enum  competition_status { COMPETITION_DISABLED = 1 << 0 , COMPETITION_CONNECTED = 1 << 2 , COMPETITION_AUTONOMOUS = 1 << 1 , COMPETITION_SYSTEM = 1 << 3 }
 
const char * baked_date
 
const char * baked_time
 
uint8_t competition_get_status (void)
 
uint8_t competition_is_disabled (void)
 
uint8_t competition_is_connected (void)
 
uint8_t competition_is_autonomous (void)
 
uint8_t competition_is_field (void)
 
int32_t battery_get_voltage (void)
 
int32_t battery_get_current (void)
 
double battery_get_temperature (void)
 
double battery_get_capacity (void)
 
int32_t usd_is_installed (void)
 
int32_t usd_list_files (const char *path, char *buffer, int32_t len)
 

Detailed Description

Note
Additional example code for this module can be found in its Tutorial.

Function Documentation

◆ battery_get_capacity()

double battery_get_capacity ( void )

Gets the current capacity of the battery, as reported by VEXos.

This function uses the following values of errno when an error state is reached: EACCES - Another resource is currently trying to access the battery port.

Returns
The current capacity of the battery

Example

◆ battery_get_current()

int32_t battery_get_current ( void )

Gets the current current of the battery, as reported by VEXos.

This function uses the following values of errno when an error state is reached: EACCES - Another resource is currently trying to access the battery port.

Returns
The current current of the battery

Example

◆ battery_get_temperature()

double battery_get_temperature ( void )

Gets the current temperature of the battery, as reported by VEXos.

This function uses the following values of errno when an error state is reached: EACCES - Another resource is currently trying to access the battery port.

Returns
The current temperature of the battery

Example

◆ battery_get_voltage()

int32_t battery_get_voltage ( void )
Returns
True if the V5 Brain is connected to VEXnet Competition Switch, false otherwise.

Example

#ifdef __cplusplus
extern "C" {
namespace pros {
#endif

◆ competition_get_status()

uint8_t competition_get_status ( void )

Get the current status of the competition control.

Returns
The competition control status as a mask of bits with COMPETITION_{ENABLED,AUTONOMOUS,CONNECTED}.

Example

◆ competition_is_autonomous()

uint8_t competition_is_autonomous ( void )
Returns
True if the V5 Brain is in autonomous mode, false otherwise.

Example

◆ competition_is_connected()

uint8_t competition_is_connected ( void )
Returns
True if the V5 Brain is connected to competition control, false otherwise.

Example

◆ competition_is_disabled()

uint8_t competition_is_disabled ( void )
Returns
True if the V5 Brain is disabled, false otherwise.

Example

◆ competition_is_field()

uint8_t competition_is_field ( void )
Returns
True if the V5 Brain is connected to VEXnet Field Controller, false otherwise.

Example

◆ usd_is_installed()

int32_t usd_is_installed ( void )

Checks if the SD card is installed.

Returns
1 if the SD card is installed, 0 otherwise

Example

◆ usd_list_files()

int32_t usd_list_files ( const char * path,
char * buffer,
int32_t len )

Lists the files in a directory specified by the path Puts the list of file names (NOT DIRECTORIES) into the buffer seperated by newlines

This function uses the following values of errno when an error state is reached:

EIO - Hard error occured in the low level disk I/O layer EINVAL - file or directory is invalid, or length is invalid EBUSY - THe physical drinve cannot work ENOENT - cannot find the path or file EINVAL - the path name format is invalid EACCES - Access denied or directory full EEXIST - Access denied EROFS - SD card is write protected ENXIO - drive number is invalid or not a FAT32 drive ENOBUFS - drive has no work area ENFILE - too many open files

Note
use a path of "\" to list the files in the main directory NOT "/usd/" DO NOT PREPEND YOUR PATHS WITH "/usd/" \return 1 on success or PROS_ERR on failure setting errno \b Example @code void opcontrol() { char* test = (char*) malloc(128); pros::c::usd_list_files("/", test, 128); pros::delay(200); printf("s
", test); //Prints the file names in the root directory seperated by newlines pros::delay(100); pros::c::usd_list_files("/test", test, 128); pros::delay(200); printf("s
", test); //Prints the names of files in the folder named test seperated by *newlines pros::delay(100); }

Variable Documentation

◆ baked_date

const char* baked_date
extern

Date and Time