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] | c | character 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_copy | position of character(s) to shift
  [in] | nb_copy | number of characters to shift
  [in] | to_shift | where 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] | line | line entered by user (NULL on CTRL+D)

Definition at line 33 of file terminal.c.