1145 |
kaklik |
1 |
/*! \file vt100.c \brief VT100 terminal function library. */ |
|
|
2 |
//***************************************************************************** |
|
|
3 |
// |
|
|
4 |
// File Name : 'vt100.c' |
|
|
5 |
// Title : VT100 terminal function library |
|
|
6 |
// Author : Pascal Stang - Copyright (C) 2002 |
|
|
7 |
// Created : 2002.08.27 |
|
|
8 |
// Revised : 2002.08.27 |
|
|
9 |
// Version : 0.1 |
|
|
10 |
// Target MCU : Atmel AVR Series |
|
|
11 |
// Editor Tabs : 4 |
|
|
12 |
// |
|
|
13 |
// NOTE: This code is currently below version 1.0, and therefore is considered |
|
|
14 |
// to be lacking in some functionality or documentation, or may not be fully |
|
|
15 |
// tested. Nonetheless, you can expect most functions to work. |
|
|
16 |
// |
|
|
17 |
// This code is distributed under the GNU Public License |
|
|
18 |
// which can be found at http://www.gnu.org/licenses/gpl.txt |
|
|
19 |
// |
|
|
20 |
//***************************************************************************** |
|
|
21 |
|
|
|
22 |
#include <avr/io.h> |
|
|
23 |
#include <avr/interrupt.h> |
|
|
24 |
#include <avr/pgmspace.h> |
|
|
25 |
|
|
|
26 |
#include "global.h" |
|
|
27 |
#include "rprintf.h" |
|
|
28 |
#include "vt100.h" |
|
|
29 |
|
|
|
30 |
// Program ROM constants |
|
|
31 |
|
|
|
32 |
// Global variables |
|
|
33 |
|
|
|
34 |
// Functions |
|
|
35 |
void vt100Init(void) |
|
|
36 |
{ |
|
|
37 |
// initializes terminal to "power-on" settings |
|
|
38 |
// ESC c |
|
|
39 |
rprintfProgStrM("\x1B\x63"); |
|
|
40 |
} |
|
|
41 |
|
|
|
42 |
void vt100ClearScreen(void) |
|
|
43 |
{ |
|
|
44 |
// ESC [ 2 J |
|
|
45 |
rprintfProgStrM("\x1B[2J"); |
|
|
46 |
} |
|
|
47 |
|
|
|
48 |
void vt100SetAttr(u08 attr) |
|
|
49 |
{ |
|
|
50 |
// ESC [ Ps m |
|
|
51 |
rprintf("\x1B[%dm",attr); |
|
|
52 |
} |
|
|
53 |
|
|
|
54 |
void vt100SetCursorMode(u08 visible) |
|
|
55 |
{ |
|
|
56 |
if(visible) |
|
|
57 |
// ESC [ ? 25 h |
|
|
58 |
rprintf("\x1B[?25h"); |
|
|
59 |
else |
|
|
60 |
// ESC [ ? 25 l |
|
|
61 |
rprintf("\x1B[?25l"); |
|
|
62 |
} |
|
|
63 |
|
|
|
64 |
void vt100SetCursorPos(u08 line, u08 col) |
|
|
65 |
{ |
|
|
66 |
// ESC [ Pl ; Pc H |
|
|
67 |
rprintf("\x1B[%d;%dH",line,col); |
|
|
68 |
} |
|
|
69 |
|