CuVoodoo STM32F1 firmware template
Functions | Variables
terminal.c File Reference

terminal prompt interface (code) More...

Go to the source code of this file.

Functions

static bool terminal_remove_line (void)
 remove one line from buffer start and shift rest to start More...
 
static void terminal_shift_line (uint16_t to_copy, uint16_t nb_copy, uint16_t to_shift)
 shift with rotate current characters to other position More...
 
static void terminal_copy_line (void)
 copy current line to last line
 
static void terminal_process_escape (void)
 process current escape code
 
static void terminal_print_line (void)
 print current line and set position
 
void terminal_setup (void)
 initialize terminal prompt
 
void terminal_send (volatile char c)
 send character to terminal More...
 

Variables

char * terminal_prefix = NULL
 terminal prompt prefix
 
void(* terminal_process )(char *line) = NULL
 called when a line is entered More...
 
static char terminal_buffer [1024] = {0}
 buffer to store user input and keep history
 
static uint16_t terminal_end = 0
 how much of the buffer is user
 
static uint16_t terminal_pos = 0
 current position in the buffer
 
static uint16_t terminal_line = 0
 start position or current line in the buffer
 
static bool terminal_last = true
 is the current line the last one
 
static bool terminal_insert = true
 currently inserting or replacing characters
 
static char escape_code [8] = {0}
 current escape code
 
static uint8_t escape_pos = 0
 current position in the escape code
 

Detailed Description

terminal prompt interface (code)

Note
allows line editing and supports some ANSI escape codes
Author
King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
Date
2018

Definition in file terminal.c.

Function Documentation

◆ terminal_remove_line()

static bool terminal_remove_line ( void  )
static

remove one line from buffer start and shift rest to start

Returns
if one line has been removed

Definition at line 55 of file terminal.c.

◆ terminal_send()

void terminal_send ( char  c)

send character to terminal

Parameters
[in]ccharacter to send

Definition at line 316 of file terminal.c.

◆ terminal_shift_line()

static void terminal_shift_line ( uint16_t  to_copy,
uint16_t  nb_copy,
uint16_t  to_shift 
)
static

shift with rotate current characters to other position

Note
this uses a recursive function
Parameters
[in]to_copyposition of character(s) to shift
[in]nb_copynumber of characters to shift
[in]to_shiftwhere to shift the characters to

Definition at line 94 of file terminal.c.

Variable Documentation

◆ terminal_process

void(* terminal_process) (char *line) = NULL

called when a line is entered

Parameters
[in]lineline entered by user (NULL on CTRL+D)

Definition at line 33 of file terminal.c.