115 for (uint16_t i=0; i<line_len; i++) {
151 uint16_t terminal_line_new=0;
154 terminal_line_new = pos+1;
250 uint16_t terminal_line_new = 0;
266 for (uint16_t i=terminal_line_new; i<
terminal_end-1; i++) {
268 terminal_line_new = i+1;
318 static char newline_last = 0;
322 if (c>=0x40 && c<=0x5f) {
330 if (c>=0x20 && c<=0x3f) {
335 }
else if (c>=0x40 && c<=0x7f) {
350 }
else if (0x1b==c) {
352 }
else if (0x03==c) {
355 for (uint16_t i=terminal_line_new; i<
terminal_end-1; i++) {
357 terminal_line_new = i+1;
383 if (
'\r'== c ||
'\n'==c) {
384 if (
'\r'==newline_last &&
'\n'==c) {
404 }
else if (0x7f==c) {
static bool terminal_insert
currently inserting or replacing characters
void terminal_send(volatile char c)
send character to terminal
static bool terminal_last
is the current line the last one
global definitions and methods (API)
static void terminal_copy_line(void)
copy current line to last line
terminal prompt interface (API)
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
static char terminal_buffer[1024]
buffer to store user input and keep history
static void terminal_print_line(void)
print current line and set position
void terminal_setup(void)
initialize terminal prompt
static uint16_t terminal_end
how much of the buffer is user
static uint16_t terminal_pos
current position in the buffer
static uint16_t terminal_line
start position or current line in the buffer
size_t printf(const char *format,...)
print format string on user output
static char escape_code[8]
current escape code
printing utilities to replace the large printf from the standard library (API)
static uint8_t escape_pos
current position in the escape code
#define LENGTH(x)
get the length of an array
static void terminal_process_escape(void)
process current escape code
static bool terminal_remove_line(void)
remove one line from buffer start and shift rest to start
void(* terminal_process)(char *line)
called when a line is entered
char * terminal_prefix
terminal prompt prefix