Display.h implementation for UART output.
============================================================================
DisplayUart specifics
DisplayUart has two sets of function pointer tables. One which adds some ANSI/VT100 codes to the output, for cursor placement etc, and a minimal implementation which basically is a wrapper for UART_write.
- DisplayUartAnsi_fxnTable
- DisplayUartMin_fxnTable
DisplayUartMin
DisplayUartMin simply formats and outputs the text over UART and adds a newline at the end of each statement.
Calls to Display_clear, Display_clearLine(s), and the line and column specifiers in Display_printf(handle, line, col, fmt, ...) are ignored.
DisplayUartAnsi
DisplayUartAnsi will send the following escape-strings to the UART when it is opened:
- Reset terminal
- Clear screen
- Set scrolling region from line 10 (not inclusive)
- Set cursor to line 11
When Display_print(handle, line, col, fmt, ...) is called with a line number the following is sent:
- Save cursor position
- Set scroll region from line 10
- Move cursor to line, column
- String to be printed
- Restore cursor position
If Display_printf is called with the line "number" DisplayUart_SCROLLING
, the string to be printed is simply output at the current cursor location, without saving or restoring the position. If the terminal supports the scrolling region feature, as most do, then the terminal will ensure that the content output here will scroll up but not overwrite the text written outside the scroll region.
In this manner it is possible to have two separate outputs, one with a log of events, and one with fixed positions as on an LCD. Unless the DisplayUart_SCROLLING
line specifier is used, any line number can be used, also those nominally inside the scrolling region.
There is also a helper file <ti/display/AnsiColor.h> with a macro to set the color and style of the text.
Usage Example
#define MAXPRINTLEN 128
static char uartStringBuf[MAXPRINTLEN];
.baudRate = 115200,
.mutexTimeout = BIOS_WAIT_FOREVER,
.strBuf = uartStringBuf,
.strBufLen = MAXPRINTLEN,
};
{
.object = &displayUartObject,
.hwAttrs = &displayUartHWAttrs
}
};
const uint8_t Display_count =
sizeof(Display_config) /
sizeof(
Display_Config);
void myTask(uintptr_t a0, uintptr_t a1)
{
}