ADI console menu library
Revision 4:ced4fa6875ed, committed 2021-05-09
- Comitter:
- mahphalke
- Date:
- Sun May 09 22:59:54 2021 +0530
- Parent:
- 3:b491377501ce
- Commit message:
- Added more ANSI VT100 escape sequences
Changed in this revision
adi_console_menu.c | Show annotated file Show diff for this revision Revisions of this file |
adi_console_menu.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r b491377501ce -r ced4fa6875ed adi_console_menu.c --- a/adi_console_menu.c Fri Feb 19 09:25:57 2021 +0000 +++ b/adi_console_menu.c Sun May 09 22:59:54 2021 +0530 @@ -278,7 +278,7 @@ * Dedicated call to move home is because sometimes first move home doesn't work * \r\n required to flush the uart buffer. */ - printf("\x1B[2J\x1B[H\r\n"); + printf(VT100_CLEAR_CONSOLE VT100_MOVE_TO_HOME EOL); /* * if VT100 is not supported, this can be enabled instead, but menu display may not work well
diff -r b491377501ce -r ced4fa6875ed adi_console_menu.h --- a/adi_console_menu.h Fri Feb 19 09:25:57 2021 +0000 +++ b/adi_console_menu.h Sun May 09 22:59:54 2021 +0530 @@ -30,7 +30,11 @@ #define EOL "\r\n" /* ANSI VT100 escape sequence codes */ -#define VT100_MOVE_UP_1_LINE "\033[A" +#define VT100_MOVE_UP_1_LINE "\033[A" +#define VT100_MOVE_UP_N_LINES "\x1B[%dA" +#define VT100_CLEAR_CURRENT_LINE "\x1B[J" +#define VT100_CLEAR_CONSOLE "\x1B[2J" +#define VT100_MOVE_TO_HOME "\x1B[H" #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) ((sizeof (x)) / (sizeof ((x)[0])))