/* This function displays a menu and waits for an input char to be received from the UART. */
int get_menu_item(char *menu_table[])
/* This function displays a menu and waits for an input char to be received from the UART. */
int get_menu_item(char *menu_table[])
{
    uint8_t input;
    int i, menu_item, num_items;
    for (i = 0; *menu_table[i] != '\0'; i++) {
        printf("%d. %s\n", i, menu_table[i]);
    }
    num_items = i;
    menu_item = -1;
    while (menu_item == -1) {
        printf("Select > ");
        do {
            input = getchar();
        } while (input == NONE_CHAR);
        if ((input >= '0') && (input <= '9')) {
            menu_item = input - '0';
            if (menu_item < num_items) {
                printf("%1d\n", menu_item);
                return (menu_item);
            } else
                menu_item = -1;
        }
    }
    return (menu_item);
}