00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _VT100_H_
00025
00026 #define vt100_bell "\007"
00027 #define vt100_bs "\010"
00028 #define vt100_bs_clear "\010 \010"
00029 #define vt100_tab "\011"
00030 #define vt100_crnl "\012\015"
00031 #define vt100_clear_right "\033[0K"
00032 #define vt100_clear_left "\033[1K"
00033 #define vt100_clear_down "\033[0J"
00034 #define vt100_clear_up "\033[1J"
00035 #define vt100_clear_line "\033[2K"
00036 #define vt100_clear_screen "\033[2J"
00037 #define vt100_up_arr "\033\133\101"
00038 #define vt100_down_arr "\033\133\102"
00039 #define vt100_right_arr "\033\133\103"
00040 #define vt100_left_arr "\033\133\104"
00041 #define vt100_multi_right "\033\133%uC"
00042 #define vt100_multi_left "\033\133%uD"
00043 #define vt100_suppr "\033\133\063\176"
00044 #define vt100_home "\033M\033E"
00045 #define vt100_word_left "\033\142"
00046 #define vt100_word_right "\033\146"
00047
00048
00049
00050
00051 #define KEY_UP_ARR 0
00052 #define KEY_DOWN_ARR 1
00053 #define KEY_RIGHT_ARR 2
00054 #define KEY_LEFT_ARR 3
00055 #define KEY_BKSPACE 4
00056 #define KEY_RETURN 5
00057 #define KEY_CTRL_A 6
00058 #define KEY_CTRL_E 7
00059 #define KEY_CTRL_K 8
00060 #define KEY_CTRL_Y 9
00061 #define KEY_CTRL_C 10
00062 #define KEY_CTRL_F 11
00063 #define KEY_CTRL_B 12
00064 #define KEY_SUPPR 13
00065 #define KEY_TAB 14
00066 #define KEY_CTRL_D 15
00067 #define KEY_CTRL_L 16
00068 #define KEY_RETURN2 17
00069 #define KEY_META_BKSPACE 18
00070 #define KEY_WLEFT 19
00071 #define KEY_WRIGHT 20
00072 #define KEY_HELP 21
00073
00074 extern const prog_char * vt100_commands[] PROGMEM;
00075
00076 enum vt100_parser_state {
00077 VT100_INIT,
00078 VT100_ESCAPE,
00079 VT100_ESCAPE_CSI,
00080 };
00081
00082 #define VT100_BUF_SIZE 8
00083 struct vt100 {
00084 uint8_t bufpos;
00085 char buf[VT100_BUF_SIZE];
00086 enum vt100_parser_state state;
00087 };
00088
00092 void vt100_init(struct vt100 * vt);
00093
00100 int8_t vt100_parser(struct vt100 *vt, char c);
00101
00102 #endif