Data Structures | Macros | Typedefs | Functions | Variables
DisplayUart.h File Reference

Detailed Description

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.


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 will send the following escape-strings to the UART when it is opened:

When Display_print(handle, line, col, fmt, ...) is called with a line number the following is sent:

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
DisplayUart_Object displayUartObject;
static char uartStringBuf[MAXPRINTLEN];
const DisplayUart_HWAttrs displayUartHWAttrs = {
.uartIdx = CONFIG_UART0,
.baudRate = 115200,
.mutexTimeout = BIOS_WAIT_FOREVER,
.strBuf = uartStringBuf,
const Display_Config Display_config[] = {
//.fxnTablePtr = &DisplayUartMin_fxnTable,
.object = &displayUartObject,
.hwAttrs = &displayUartHWAttrs
const uint8_t Display_count = sizeof(Display_config) / sizeof(Display_Config);
void myTask(uintptr_t a0, uintptr_t a1)
Display_printf(handle, 1, 0, "Hello");
Display_printf(handle, 2, 6, ANSI_COLOR(FG_GREEN) "World!" ANSI_COLOR(ATTR_RESET));

#include <ti/drivers/dpl/SemaphoreP.h>
#include <ti/drivers/UART.h>
#include <ti/display/Display.h>
#include <stdint.h>
Include dependency graph for DisplayUart.h:

Go to the source code of this file.

Data Structures

struct  DisplayUart_HWAttrs
 DisplayUart Attributes. More...
struct  DisplayUart_Object
 DisplayUart Object. More...


#define DisplayUart_fxnTable   DisplayUartMin_fxnTable
#define DisplayUart_SCROLLING   0xFF


typedef struct DisplayUart_HWAttrs DisplayUart_HWAttrs
 DisplayUart Attributes. More...
typedef struct DisplayUart_Object DisplayUart_Object
 DisplayUart Object. More...
typedef struct DisplayUart_ObjectDisplayUart_Handle


void DisplayUartMin_init (Display_Handle handle)
void DisplayUartAnsi_init (Display_Handle handle)
Display_Handle DisplayUartMin_open (Display_Handle, Display_Params *params)
Display_Handle DisplayUartAnsi_open (Display_Handle, Display_Params *params)
void DisplayUartMin_clear (Display_Handle handle)
void DisplayUartAnsi_clear (Display_Handle handle)
void DisplayUartMin_clearLines (Display_Handle handle, uint8_t fromLine, uint8_t toLine)
void DisplayUartAnsi_clearLines (Display_Handle handle, uint8_t fromLine, uint8_t toLine)
void DisplayUartMin_vprintf (Display_Handle handle, uint8_t line, uint8_t column, char *fmt, va_list va)
void DisplayUartAnsi_vprintf (Display_Handle handle, uint8_t line, uint8_t column, char *fmt, va_list va)
void DisplayUartMin_close (Display_Handle)
void DisplayUartAnsi_close (Display_Handle)
int DisplayUartMin_control (Display_Handle handle, unsigned int cmd, void *arg)
int DisplayUartAnsi_control (Display_Handle handle, unsigned int cmd, void *arg)
unsigned int DisplayUartMin_getType (void)
unsigned int DisplayUartAnsi_getType (void)


const Display_FxnTable DisplayUartMin_fxnTable
const Display_FxnTable DisplayUartAnsi_fxnTable

Macro Definition Documentation

§ DisplayUart_fxnTable

#define DisplayUart_fxnTable   DisplayUartMin_fxnTable

§ DisplayUart_SCROLLING

#define DisplayUart_SCROLLING   0xFF

Typedef Documentation

§ DisplayUart_HWAttrs

DisplayUart Attributes.

The DisplayUart driver uses a buffer for formatting messages, which is then passed to UART_write(). The location and size of the buffer are specified in a DisplayUart_HWAttrs structure. Access to the buffer is synchronized by a semaphore. The timeout for acquiring the semaphore is specified in the attributes.

§ DisplayUart_Object

DisplayUart Object.

The application must not access any member variables of this structure!

§ DisplayUart_Handle

Function Documentation

§ DisplayUartMin_init()

void DisplayUartMin_init ( Display_Handle  handle)

§ DisplayUartAnsi_init()

void DisplayUartAnsi_init ( Display_Handle  handle)

§ DisplayUartMin_open()

Display_Handle DisplayUartMin_open ( Display_Handle  ,
Display_Params params 

§ DisplayUartAnsi_open()

Display_Handle DisplayUartAnsi_open ( Display_Handle  ,
Display_Params params 

§ DisplayUartMin_clear()

void DisplayUartMin_clear ( Display_Handle  handle)

§ DisplayUartAnsi_clear()

void DisplayUartAnsi_clear ( Display_Handle  handle)

§ DisplayUartMin_clearLines()

void DisplayUartMin_clearLines ( Display_Handle  handle,
uint8_t  fromLine,
uint8_t  toLine 

§ DisplayUartAnsi_clearLines()

void DisplayUartAnsi_clearLines ( Display_Handle  handle,
uint8_t  fromLine,
uint8_t  toLine 

§ DisplayUartMin_vprintf()

void DisplayUartMin_vprintf ( Display_Handle  handle,
uint8_t  line,
uint8_t  column,
char *  fmt,
va_list  va 

§ DisplayUartAnsi_vprintf()

void DisplayUartAnsi_vprintf ( Display_Handle  handle,
uint8_t  line,
uint8_t  column,
char *  fmt,
va_list  va 

§ DisplayUartMin_close()

void DisplayUartMin_close ( Display_Handle  )

§ DisplayUartAnsi_close()

void DisplayUartAnsi_close ( Display_Handle  )

§ DisplayUartMin_control()

int DisplayUartMin_control ( Display_Handle  handle,
unsigned int  cmd,
void *  arg 

§ DisplayUartAnsi_control()

int DisplayUartAnsi_control ( Display_Handle  handle,
unsigned int  cmd,
void *  arg 

§ DisplayUartMin_getType()

unsigned int DisplayUartMin_getType ( void  )

§ DisplayUartAnsi_getType()

unsigned int DisplayUartAnsi_getType ( void  )

Variable Documentation

§ DisplayUartMin_fxnTable

const Display_FxnTable DisplayUartMin_fxnTable

§ DisplayUartAnsi_fxnTable

const Display_FxnTable DisplayUartAnsi_fxnTable
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale