Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Updated May 2025

FreeRTOS_CLIGetOutputBuffer()

FreeRTOS_CLI.h

1char *FreeRTOS_CLIGetOutputBuffer( void );

FreeRTOS-Plus-CLI is an extensible framework that allows the application writer to define and register their own command line input commands. Separate documentation pages are provided that describe how to write a function that implements the behaviour of a user defined command, how to register user defined commands with FreeRTOS-Plus-CLI and how to integrate FreeRTOS-Plus-CLI into a FreeRTOS task.

This page describes the optional FreeRTOS_CLIGetOutputBuffer() function.

Command interpreter implementations require an output buffer that is used to hold any output generated by running a command.

If FreeRTOS-Plus-CLI is used to implement a single command interpreter interface, the output buffer can be defined locally to the task or file that that executes the FreeRTOS_CLIProcessCommand() API function.

If FreeRTOS-Plus-CLI is used to implement a command interpreter on multiple interfaces, a UART and a TCP/IP socket for example, then both interfaces could provide their own output buffers in the same manner. However, if only one of the interfaces is going to be used at a time, then RAM can be saved by having both interfaces share a single output buffer. FreeRTOS_CLIGetOutputBuffer() is provided to make this easier.

Parameters:

None.

Returns:

FreeRTOS_CLIGetOutputBuffer() does nothing more than return the address of an output buffer that is declared within the FreeRTOS-Plus-CLI code - removing the need for command interface implementations to declare their own.

The size of the buffer is defined by the configCOMMAND_INT_MAX_OUTPUT_SIZE constant, which should be defined in FreeRTOSConfig.h whenever FreeRTOS-Plus-CLI is used.

configCOMMAND_INT_MAX_OUTPUT_SIZE should be set to 1 to minimise RAM usage if all command interpreter interfaces use their own locally defined buffers, and the FreeRTOS_CLIGetOutputBuffer() API function is not used.