Displays user interactions with menus displayed on a console or a serial terminal.

Dependents:   EVAL-AD568x-AD569x EVAL-AD7124 EVAL-AD5592R EVAL-AD717x-AD411x ... more

Revision:
8:17fbfba02ff1
Parent:
7:49c1587ecd29
Child:
9:dee92955bc3d
--- a/adi_console_menu.c	Tue Feb 15 15:45:15 2022 +0530
+++ b/adi_console_menu.c	Fri May 06 17:40:22 2022 +0530
@@ -29,7 +29,6 @@
 #include <assert.h>
 
 #include "adi_console_menu.h"
-#include "error.h"
 
 /****************************************************************************/
 /********************** Macros and Constants Definition *********************/
@@ -41,7 +40,7 @@
 /******************************************************************************/
 // Saves the state of console menu library
 console_menu_state adi_console_menu_state = {
-	.last_error_code = SUCCESS
+	.last_error_code = 0
 };
 
 /****************************************************************************/
@@ -325,7 +324,7 @@
  * @param   max_attempts[in] - Maximum number of input attempts.
  * @param   clear_lines[in] - lines to clear in case of
                               invalid input.
- * @return	SUCCESS in case success. otherwise FAILURE
+ * @return	0 in case of success. -1 otherwise.
  */
 int32_t adi_handle_user_input_integer(const char* menu_prompt,
 			      uint16_t min_val,
@@ -338,7 +337,7 @@
 	uint8_t count = 0;
 
 	if (menu_prompt == NULL || input_val == NULL) {
-		return FAILURE;
+		return -1;
 	}
 
 	do {
@@ -354,7 +353,7 @@
 			if (count == max_attempts) {
 				printf(EOL "Maximum try limit exceeded" EOL);
 				adi_press_any_key_to_continue();
-				return FAILURE;
+				return -1;
 			}
 
 			printf(EOL "Please enter a valid selection" EOL);
@@ -368,7 +367,7 @@
 		}
 	} while (++count <= max_attempts);
 
-	return SUCCESS;
+	return 0;
 }
 
 /**
@@ -383,7 +382,7 @@
  * @param   max_attempts[in] - Maximum number of input attempts.
  * @param   clear_lines[in] - lines to clear in case of
                               invalid input.
- * @return	SUCCESS in case success. otherwise FAILURE
+ * @return	0 in case of success. -1 otherwise.
  */
 int32_t adi_handle_user_input_float(const char* menu_prompt,
 	float min_val,
@@ -396,7 +395,7 @@
 	uint8_t count = 0;
 
 	if (menu_prompt == NULL || input_val == NULL) {
-		return FAILURE;
+		return -1;
 	}
 
 	do {
@@ -413,7 +412,7 @@
 			if (count == max_attempts) {
 				printf(EOL "Maximum try limit exceeded" EOL);
 				adi_press_any_key_to_continue();
-				return FAILURE;
+				return -1;
 			}
 
 			printf(EOL "Please enter a valid selection" EOL);
@@ -427,7 +426,7 @@
 		}
 	} while (++count <= max_attempts);
 
-	return SUCCESS;
+	return 0;
 }
 
 /*!
@@ -459,7 +458,7 @@
  */
 void adi_clear_last_menu_error(void)
 {
-	adi_console_menu_state.last_error_code = SUCCESS;
+	adi_console_menu_state.last_error_code = 0;
 }
 
 /*!