C2A_Core
vt100.c
[詳解]
1 #pragma section REPRO
2 #include "vt100.h"
3 
5 
6 void VT100_erase_down(void)
7 {
8  Printf("\x1b[J");
9 }
10 
11 void VT100_erase_up(void)
12 {
13  Printf("\x1b[1J");
14 }
15 
17 {
18  Printf("\x1b[2J");
19 }
20 
22 {
23  Printf("\x1b[K");
24 }
25 
27 {
28  Printf("\x1b[1K");
29 }
30 
31 void VT100_erase_line(void)
32 {
33  Printf("\x1b[2K");
34 }
35 
37 {
38  switch (color)
39  {
40  case RED:
41  Printf("\x1b[31m");
42  break;
43 
44  case GREEN:
45  Printf("\x1b[32m");
46  break;
47 
48  case YELLOW:
49  Printf("\x1b[33m");
50  break;
51 
52  case BLUE:
53  Printf("\x1b[34m");
54  break;
55 
56  default:
57  Printf("\x1b[m");
58  break;
59  }
60 }
61 
63 {
64  switch (color)
65  {
66  case RED:
67  Printf("\x1b[41m");
68  break;
69 
70  case GREEN:
71  Printf("\x1b[42m");
72  break;
73 
74  case YELLOW:
75  Printf("\x1b[43m");
76  break;
77 
78  case BLUE:
79  Printf("\x1b[44m");
80  break;
81 
82  default:
83  Printf("\x1b[m");
84  break;
85  }
86 }
87 
89 {
90  Printf("\x1b[m");
91 }
92 
94 {
95  Printf("\x1B[0;0H");
96 }
97 
98 #pragma section
HW 依存 Print, つまり ログ情報のフォーマット出力(デバッグ出力)
void Printf(const char *format,...)
Definition: print.c:9
void VT100_erase_line(void)
Definition: vt100.c:31
void VT100_erase_up(void)
Definition: vt100.c:11
void VT100_erase_screen(void)
Definition: vt100.c:16
void VT100_set_color(VT100_ColorMode color)
Definition: vt100.c:36
void VT100_erase_start_of_line(void)
Definition: vt100.c:26
void VT100_reset_color(void)
Definition: vt100.c:88
void VT100_reset_cursor(void)
Definition: vt100.c:93
void VT100_erase_down(void)
Definition: vt100.c:6
void VT100_set_background(VT100_ColorMode color)
Definition: vt100.c:62
void VT100_erase_end_of_line(void)
Definition: vt100.c:21
VT100_ColorMode
Definition: vt100.h:5
@ BLUE
Definition: vt100.h:9
@ GREEN
Definition: vt100.h:7
@ YELLOW
Definition: vt100.h:8
@ RED
Definition: vt100.h:6