embedded-software
reusable software modules for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Terminal Helper Functions

Enumerations

enum  term_color {
  Reset_all_attributes = 0, Bright, Dim, Underscore,
  Blink, Reverse, Hidden, ForegroundBlack = 30,
  ForegroundRed, ForegroundGreen, ForegroundYellow, ForegroundBlue,
  ForegroundMagenta, ForegroundCyan, ForegroundWhite, BackgroundBlack = 40,
  BackgroundRed, BackgroundGreen, BackgroundYellow, BackgroundBlue,
  BackgroundMagenta, BackgroundCyan, BackgroundWhite
}
 

Functions

void Terminal_CharXY (uint8_t channel, char c, char x, char y)
 
void Terminal_CursorXY (uint8_t channel, char x, char y)
 
void Terminal_HideCursor (uint8_t channel)
 
void Terminal_ShowCursor (uint8_t channel)
 
void Terminal_SetColor (uint8_t channel, enum term_color color)
 
void Terminal_ClearScreen (uint8_t channel)
 

Detailed Description

Enumeration Type Documentation

enum term_color

This enumeration allows the user to easily set up specific configurations for the characters which are printed to the terminal. The position in this enumeration corresponds to the ANSI Escape Sequences for color text and formatting. Please reference http://bluesock.org/~willg/dev/ansi.html for specifics on which element in the enumeration is responsible for controlling what attribute within the terminal.

Warning
RT 10/10
Enumerator
Reset_all_attributes 
Bright 
Dim 
Underscore 
Blink 
Reverse 
Hidden 
ForegroundBlack 
ForegroundRed 
ForegroundGreen 
ForegroundYellow 
ForegroundBlue 
ForegroundMagenta 
ForegroundCyan 
ForegroundWhite 
BackgroundBlack 
BackgroundRed 
BackgroundGreen 
BackgroundYellow 
BackgroundBlue 
BackgroundMagenta 
BackgroundCyan 
BackgroundWhite 

Function Documentation

void Terminal_CharXY ( uint8_t  channel,
char  c,
char  x,
char  y 
)

Reusable function to push a character to a terminal at a specific location.

This function will only work when the buffer is used to communicate to a terminal supporting the used features (e.g. PuTTY)

Location 0,0 is the top left corner of the terminal

Parameters
channelUART channel
cchar to send
xzero base x location
yzero base y location

Here is the caller graph for this function:

void Terminal_ClearScreen ( uint8_t  channel)

Function to clear terminal

This function allows you to clear the entire terminal screen. This function creates a new terminal page through the ASCII code "\f".

Parameters
channel
color
void Terminal_CursorXY ( uint8_t  channel,
char  x,
char  y 
)

Here is the caller graph for this function:

void Terminal_HideCursor ( uint8_t  channel)

Function to turn the cursor off

This function will make the cursor within the terminal hidden by utilizing the DECTCEM (DEC text cursor enable mode) escape sequence "%c[?25l". The ASCII_ESC character is needed so the terminal knows that the above sequence is a control sequence.

Parameters
channelUART Channel
Warning
RT 10/10
void Terminal_SetColor ( uint8_t  channel,
enum term_color  color 
)

Function to set color of terminal

This function allows you to set the color of the terminal. The function utilizes the ASCII code "%c[%dm" to implement the function. The ASCII_ESC character is needed so the terminal knows that the above sequence is a control sequence, c. The ASCII color represented by d in the ASCII code is used to change the coloring. Dependant on the value of color will depend on the change. For example: 0-9 gives you different attributes such as bold/invisible/bright; using 30-39 will change the foreground coloring; using 40-49 will change the background coloring. Check https://en.wikipedia.org/wiki/ANSI_escape_code for more details of the commands.

Parameters
channel
color

Here is the caller graph for this function:

void Terminal_ShowCursor ( uint8_t  channel)

Function to turn the cursor on

This function will make the cursor within the terminal hidden by utilizing the DECTCEM (DEC text cursor enable mode) escape sequence "%c?25h". The ASCII_ESC character is needed so the terminal knows that the above sequence is a control sequence.

Parameters
channel