| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | /*
|
| 2 | **
|
| 3 | ** File Description:
|
| 4 | **
|
| 5 | ** basic user interface header file
|
| 6 | **
|
| 7 | **
|
| 8 | */
|
| 9 |
|
| 10 | #ifndef __MISLIC_UI_HDR__
|
| 11 | #define __MISLIC_UI_HDR__
|
| 12 |
|
| 13 | #include <stdio.h>
|
| 14 |
|
| 15 |
|
| 16 | #define ASCII_ESC 27
|
| 17 | #define MISLIC_EOL '\n'
|
| 18 | #define MISLIC_CLS printf("%c[2J", ASCII_ESC)
|
| 19 | #define MISLIC_MAX_COL 80
|
| 20 | #define MISLIC_PROMPT "--> "
|
| 21 | #define display_menu_prompt(X) printf("Select Menu item for chan: %u or 'q' to quit or 'r' to redisplay menu %s ", (X), MISLIC_PROMPT)
|
| 22 | #define REDISPLAY_MENU 0xFE
|
| 23 | #define QUIT_MENU 0xFF
|
| 24 |
|
| 25 |
|
| 26 | #ifdef SILABS_USE_SETVBUF
|
| 27 | #define SETUP_STDOUT_FLUSH setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0);
|
| 28 | #define FLUSH_STDOUT printf("\n");fflush(stdout);
|
| 29 | #else
|
| 30 | #define SETUP_STDOUT_FLUSH
|
| 31 | #define FLUSH_STDOUT
|
| 32 | #endif
|
| 33 |
|
| 34 | void print_banner(const char *banner);
|
| 35 | int display_menu(const char *menu_header, const char **menu_items);
|
| 36 |
|
| 37 | int get_menu_selection(int max_count, int current_channel);
|
| 38 | int get_int(int min_value, int max_max);
|
| 39 | int get_prompted_int(int min_value, int max_max, const char *prompt);
|
| 40 | unsigned int get_hex(unsigned int min_value, unsigned int max_value);
|
| 41 | int get_char(char *legal_chars, char *user_input);
|
| 42 | int get_char_range(char start_range, char end_range);
|
| 43 | int get_fn(char *prompt, char *buffer);
|
| 44 |
|
| 45 | int kbhit(void);
|
| 46 |
|
| 47 | #endif /* __MISLIC_UI_HDR__ */
|
| 48 |
|