FreeRTOS Emulator with SDL2 Based Graphics and Input Library  1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
GFX Printing

Thread safe printing API. More...

Macros

#define PRINT_ERROR(msg, ...)
 
#define PRINT_TASK_ERROR(task)   PRINT_ERROR("Failed to print task ##task");
 

Functions

void fprints (FILE *__restrict __stream, const char *__format,...)
 Prints a formatted string to the specifed IO stream. More...
 
void prints (const char *__format,...)
 Prints a formatted string to stdout More...
 
int gfxSafePrintInit (void)
 Initializes the printing module. More...
 
void gfxSafePrintExit (void)
 Exits the printing module. More...
 

Safe print configuration default values

Allows for the configuration of each print messages length and the number of print messages that FreeRTOS can buffer

#define SAFE_PRINT_QUEUE_LEN   20
 
#define SAFE_PRINT_MAX_MSG_LEN   256
 
#define SAFE_PRINT_STACK_SIZE   (SAFE_PRINT_MAX_MSG_LEN * 2)
 
#define SAFE_PRINT_PRIORITY   tskIDLE_PRIORITY
 
#define SAFE_PRINT_INPUT_BUFFER_COUNT   10
 

Detailed Description

Thread safe printing API.

Provides replacements for printf and fprintf with the two functions prints and fprints, standing for "print safe".

Both functions are variadic and wrap the standard print functions, meaning their use is identical and as such the documentations for printf and fprintf can be used as reference.

The functions also allow writing to any IO stream, prints is simply a call to fprints where the IO stream is fixed to stdout,

Macro Definition Documentation

◆ PRINT_ERROR

#define PRINT_ERROR (   msg,
  ... 
)
Value:
fprintf(stderr, "[ERROR] " msg, ##__VA_ARGS__); \
fprintf(stderr, " @-> %s:%d, %s\n", __FILE__, __LINE__, __func__)

◆ PRINT_TASK_ERROR

#define PRINT_TASK_ERROR (   task)    PRINT_ERROR("Failed to print task ##task");

◆ SAFE_PRINT_INPUT_BUFFER_COUNT

#define SAFE_PRINT_INPUT_BUFFER_COUNT   10

◆ SAFE_PRINT_MAX_MSG_LEN

#define SAFE_PRINT_MAX_MSG_LEN   256

◆ SAFE_PRINT_PRIORITY

#define SAFE_PRINT_PRIORITY   tskIDLE_PRIORITY

◆ SAFE_PRINT_QUEUE_LEN

#define SAFE_PRINT_QUEUE_LEN   20

◆ SAFE_PRINT_STACK_SIZE

#define SAFE_PRINT_STACK_SIZE   (SAFE_PRINT_MAX_MSG_LEN * 2)

Function Documentation

◆ fprints()

void fprints ( FILE *__restrict  __stream,
const char *  __format,
  ... 
)

Prints a formatted string to the specifed IO stream.

Parameters
__streamIO stream to print to, eg. stdio or stderr
__formatFormatting string to be printed

◆ gfxSafePrintExit()

void gfxSafePrintExit ( void  )

Exits the printing module.

◆ gfxSafePrintInit()

int gfxSafePrintInit ( void  )

Initializes the printing module.

Returns
0 on sucess

◆ prints()

void prints ( const char *  __format,
  ... 
)

Prints a formatted string to stdout

Parameters
__formatFormatting string to be printed