FreeRTOS+IO IntegrationFreeRTOS+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, and how to register user defined commands with FreeRTOS+CLI.
This page describes how to port FreeRTOS+CLI onto real hardware by providing input output (IO) routines, and a FreeRTOS+CLI task.
Input and outputA command line interface receives characters from an input, and writes characters to an output. The low level details of how this is achieved is dependent on the microcontroller being used, and the interfaces the microcontroller provides.
There is a FreeRTOS+CLI featured demo that uses the FreeRTOS+IO FreeRTOS_read() and FreeRTOS_write() API functions to provide the necessary input and output to a UART. The command line interface it creates is accessed using a standard dumb terminal program, such as HyperTerminal. There is another FreeRTOS+CLI featured demo that uses a TCP/IP sockets interface to provide the necessary input and output. The command line interface it creates is accessed using a telnet client. The structure of the FreeRTOS task that runs the FreeRTOS+CLI code is similar in both cases, and is provided below.
An example FreeRTOS+CLI taskThe source code below implements a task that manages a FreeRTOS+CLI command interpreter interface. The FreeRTOS+IO FreeRTOS_read() and FreeRTOS_write() API functions are use to provide the IO interface. It is assumed that the FreeRTOS+IO descriptor has already been opened and configured to use the interrupt driven character queue transfer mode.
The task uses the FreeRTOS+CLI FreeRTOS_CLIProcessCommand() API function.
The comments in the source code provide more information. Note this function is not re-entrant.