logger.h
Go to the documentation of this file.
1 #ifndef _ROSSERIAL_VEX_CORTEX_LOGGER_H_
2 #define _ROSSERIAL_VEX_CORTEX_LOGGER_H_
3 
4 #include "API.h"
5 
6 // VEXROS defines are used only locally.
7 
8 // debugging works over an alternative serial connection.
9 // 0 for no
10 // 1 for yes
11 #define VEXROS_DEBUG_MODE 0
12 
13 // which serial connection to output debug messages on.
14 // To switch the serial connections, switch these values.
15 // note that stdin/stdout being seperate is unique - stdin/stdout can both be replaced with either uart1 or uart2,
16 // because UART1 and UART2 work as both input and output serial connections.
17 #define VEXROS_DEBUG_OUTPUT_SERIAL uart2
18 #define VEXROS_ROSSERIAL_OUTPUT_SERIAL stdout
19 #define VEXROS_ROSSERIAL_INPUT_SERIAL stdin
20 
21 // logging function for debugging via print statements in the PROS environment.
22 // this macro simply adds formatting ontop of the regular pros frintf function.
23 // usage: vexroslog("hello, my favorite number is %d", 3);
24 // remember to include this header for logging in user code!
25 #define vexroslog(fmtstr, ...) fprintf((VEXROS_DEBUG_OUTPUT_SERIAL ), "[%d]: " " " fmtstr " " "\r\n", millis() ,##__VA_ARGS__)
26 
27 // will print to stdout, used by the serial client.;
28 #define vexroswrite(...) fprintf((VEXROS_ROSSERIAL_OUTPUT_SERIAL), __VA_ARGS__)
29 #define vexroswritechar(ch) fputc(ch, VEXROS_ROSSERIAL_OUTPUT_SERIAL)
30 #define vexrosreadchar() fgetc(VEXROS_ROSSERIAL_INPUT_SERIAL)
31 
32 // will only print if debug mode is on (see top of this file).
33 #define vexroslogdebug(fmtstr, ...) { \
34  if(DEBUG_MODE) { \
35  vexroslog(fmtstr, ##__VA_ARGS__); \
36  } \
37 }
38 
39 #endif


rosserial_vex_cortex
Author(s): Cannon
autogenerated on Fri Jun 7 2019 22:03:06