precision-converters-firmware
|
: A simple console menu manager handler More...
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "adi_console_menu.h"
Macros | |
#define | DIV_STRING "\t==================================================" |
Functions | |
int32_t | adi_do_console_menu (const console_menu *menu) |
Display a consoleMenu and handle User interaction. More... | |
int32_t | adi_get_decimal_int (uint8_t input_len) |
Reads a decimal string from the user. More... | |
uint32_t | adi_get_hex_integer (uint8_t input_len) |
Reads a hexadecimal number from the user. More... | |
float | adi_get_decimal_float (uint8_t input_len) |
Reads a floating string from the user. More... | |
int32_t | adi_handle_user_input_integer (const char *menu_prompt, uint16_t min_val, uint16_t max_val, uint16_t *input_val, uint8_t input_len, uint8_t max_attempts, uint8_t clear_lines) |
Handles the integer type input from the user by displaying the menu message and provides a set number of input attempts for the user. More... | |
int32_t | adi_handle_user_input_float (const char *menu_prompt, float min_val, float max_val, float *input_val, uint8_t input_len, uint8_t max_attempts, uint8_t clear_lines) |
Handles the float type input from the user by displaying the menu message and provides a set number of input attempts for the user. More... | |
void | adi_clear_console (void) |
Clears the console terminal. More... | |
void | adi_clear_last_menu_error (void) |
Clears the error code from the last menu. More... | |
int32_t | adi_get_last_menu_error (void) |
Returns the error code from the last menu. More... | |
void | adi_press_any_key_to_continue (void) |
waits for any key to be pressed, and displays a prompt to the user More... | |
Variables | |
console_menu_state | adi_console_menu_state |
: A simple console menu manager handler
: A way to define using arrays of structs a set of menus that can be displayed to a user, easily, with all user interaction handled by the library, leaving only the implementation of the menu actions
Copyright (c) 2019-2022 Analog Devices, Inc. All rights reserved.
This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.
#define DIV_STRING "\t==================================================" |
void adi_clear_console | ( | void | ) |
Clears the console terminal.
Clears the console terminal using VT100 escape code, or can be changed to output blank lines if serial link doesn't support VT100.
void adi_clear_last_menu_error | ( | void | ) |
Clears the error code from the last menu.
int32_t adi_do_console_menu | ( | const console_menu * | menu | ) |
Display a consoleMenu and handle User interaction.
This displays the menuItems defined by the console menu, and handles all user interaction for the menu.
float adi_get_decimal_float | ( | uint8_t | input_len | ) |
Reads a floating string from the user.
input_len | max number of character to accept from the user |
Allows a user to type in number, echoing back to the user, up to input_len chars
int32_t adi_get_decimal_int | ( | uint8_t | input_len | ) |
Reads a decimal string from the user.
input_len | max number of character to accept from the user |
Allows a user to type in number, echoing back to the user, up to input_len chars
uint32_t adi_get_hex_integer | ( | uint8_t | input_len | ) |
Reads a hexadecimal number from the user.
input_len | max number of character to accept from the user |
Allows a user to type in a hexnumber, echoing back to the user, up to input_len chars
int32_t adi_get_last_menu_error | ( | void | ) |
Returns the error code from the last menu.
int32_t adi_handle_user_input_float | ( | const char * | menu_prompt, |
float | min_val, | ||
float | max_val, | ||
float * | input_val, | ||
uint8_t | input_len, | ||
uint8_t | max_attempts, | ||
uint8_t | clear_lines | ||
) |
Handles the float type input from the user by displaying the menu message and provides a set number of input attempts for the user.
menu_prompt[in] | - User specified prompt. |
min_val[in] | - minimum input value. |
max_val[in] | - maximum input value. |
input_val[in,out] | - User provided input value. |
input_len[in] | - User provided input length. |
max_attempts[in] | - Maximum number of input attempts. |
clear_lines[in] | - lines to clear in case of invalid input. |
int32_t adi_handle_user_input_integer | ( | const char * | menu_prompt, |
uint16_t | min_val, | ||
uint16_t | max_val, | ||
uint16_t * | input_val, | ||
uint8_t | input_len, | ||
uint8_t | max_attempts, | ||
uint8_t | clear_lines | ||
) |
Handles the integer type input from the user by displaying the menu message and provides a set number of input attempts for the user.
menu_prompt[in] | - User specified prompt. |
min_val[in] | - minimum input value. |
max_val[in] | - maximum input value. |
input_val[in,out] | - User provided input value. |
input_len[in] | - User provided input length. |
max_attempts[in] | - Maximum number of input attempts. |
clear_lines[in] | - lines to clear in case of invalid input. |
void adi_press_any_key_to_continue | ( | void | ) |
waits for any key to be pressed, and displays a prompt to the user
console_menu_state adi_console_menu_state |