Menu Editor
Menu Editor Overview
This is the menu editor module is the aplication module which will edit the menu contents provided by the user.
In application text menu, the menu list and variables are declared.
The main buffer structure variable and the internal data buffer both should be declared on the application side and the pointers of the variables are used in the module.
Usage
The API functions have the first argument as the strucure instance and next followed by config structure.
Menu config and variables are initialized with module open function.
The module has an edit mode to modify the menu contents and a view mode to display the menu data.
Return codes of API functions are defined in header file.
Application Interface
Function |
Description |
---|---|
rs_menu_editor_open |
Function to open the menu editor module |
rs_menu_editor_refresh_lcd_contents |
Function to refresh the menu editor contents in lcd module |
rs_menu_editor_process |
Function to process the menu editor contents. |
rs_menu_editor_update_contents |
Function to update the menu editor contents. |
The below table contains callback functions that are to be performed from the HAL.
Function |
Description |
---|---|
rcb_keypad_action |
It executes an action when a key event (press or release) occurs. It processes the key event and triggers the appropriate response. |
Example Usecase
The example of menu listed below:
const rs_lcd_menu_list_t arr_menu_Items[] =
{
//label parent child next data id format prop
{"menu", 0, 1, 0, 0, 0, 0},//0
{"Configuration", 0, 4, 2, 0, 0, 0}, //1
{"Status", 0, 10, 3, 0, 0, 0}, //2
{"About", 0, 12, 0, 0, 0, 0}, //3
{"Control mode", 1, 0, 5, FLINT_DATA_BRIDGE_ID_DEFAULT_DATA_DB_ENUM_CONTROL_MODE, RS_DATA_PROP_STORAGE_ENUM, MENU_PROP_EDITTABLE | MENU_PROP_HAS_VALUE}, //4
{"CAN Baud rate", 1, 0, 6, FLINT_DATA_BRIDGE_ID_DEFAULT_DATA_DB_ENUM_BAUDRATE, RS_DATA_PROP_STORAGE_ENUM, MENU_PROP_EDITTABLE | MENU_PROP_HAS_VALUE}, //5
{"Open circuit", 1, 0, 9, FLINT_DATA_BRIDGE_ID_DEFAULT_DATA_DB_ENUM_OPEN_CIRCUIT, RS_DATA_PROP_STORAGE_ENUM, MENU_PROP_EDITTABLE | MENU_PROP_HAS_VALUE}, //8
{"Drive mode", 1, 0, 0, FLINT_DATA_BRIDGE_ID_DEFAULT_DATA_DB_ENUM_DRIVE_MODE, RS_DATA_PROP_STORAGE_ENUM, MENU_PROP_EDITTABLE | MENU_PROP_HAS_VALUE}, //9
{"CAN comm", 2, 0, 11, FLINT_DATA_BRIDGE_ID_DEFAULT_DATA_DB_ENUM_CAN_COMM, RS_DATA_PROP_STORAGE_ENUM, MENU_PROP_EDITTABLE | MENU_PROP_HAS_VALUE}, //10
};
Dependency
This menu editor module depends on the below RAPIDSEA modules.
Error Code
Every API’s for the menu editor returns some success or failure values. Please refer below section,
The below diagram captures the high level of Menu editor with keypad and lcd

Menu editor module Header Details
Documentation from the relevant header as follows:
rs_menu_editor
This file contains the APIs for Menu editing functionalities
- Author
Embien RAPIDSEA Team
- Copyright
Embien Technologies India Pvt. Ltd.
Defines
-
RS_MENU_MAX_ARR_SIZE
Maximum size of the array.
-
RS_MENU_NONE_MODE
Menu mode where the menu is neither view mode nor edit mode.
-
RS_MENU_VIEW_MODE
Menu mode where the menu is in view-only mode
-
RS_MENU_EDIT_MODE
Menu mode where the menu allows editing
-
RS_MENU_PROP_HAS_VALUE
Menu property indicating that the item has an associated value.
-
RS_MENU_PROP_EDITTABLE
Menu property indicating that the item can be edited
-
RS_MENU_PROP_EDIT_BY_DIGIT
Menu property indicating that only single-digit values can be edited
-
RS_MENU_VALUE_FORMAT_DECIMAL_POINTS_NONE
Value format with no decimal points.
-
RS_MENU_VALUE_FORMAT_DECIMAL_POINTS_ONE
Value format with one decimal point
-
RS_MENU_VALUE_FORMAT_DECIMAL_POINTS_TWO
Value format with two decimal points
-
RS_MENU_KEY_RIGHT
Key code for the right key.
-
RS_MENU_KEY_SET
Key code for the set/center key
-
RS_MENU_KEY_DOWN
Key code for the down key
-
RS_MENU_KEY_LEFT
Key code for the left key.
-
RS_MENU_KEY_UP
Key code for the up key
-
RS_MENU_KEY_HOLD_DURATION_1000
Duration in milliseconds for a 1-second key hold.
-
RS_MENU_KEY_HOLD_DURATION_2000
Duration in milliseconds for a 2-second key hold
-
RS_MENU_KEY_HOLD_DURATION_3000
Duration in milliseconds for a 3-second key hold
-
RS_MENU_KEY_HOLD_DURATION_10000
Duration in milliseconds for a 10-second key hold
-
RS_MENU_KEY_HOLD_DURATION_15000
Duration in milliseconds for a 15-second key hold.
-
RS_MENU_KEY_HOLD_DURATION_18000
Duration in milliseconds for an 18-second key hold.
-
RS_MENU_BLINK_CURSOR_EVERY_500MS
Time interval (in milliseconds) at which the cursor blinks.
-
RS_MENU_LINE_COUNT_1
Single Line Menu.
-
RS_MENU_LINE_COUNT_2
Two Line Menu
Typedefs
-
typedef struct tag_rs_menu_list rs_menu_list_t
Structure for the Menu list.
-
typedef struct tag_rs_menu_config rs_menu_config_t
Structure for the Menu configuration.
-
typedef struct tag_rs_menu_instance rs_menu_instance_t
Structure for the Menu instance.
Functions
-
rs_handle_t rs_menu_editor_open(rs_menu_instance_t *ptr_menu_inst, rs_menu_config_t *ptr_menu_config)
Function declarations.
Opens and initializes the menu editor instance.
This function sets up the menu editor instance by linking it with the provided configuration.
- Parameters:
ptr_menu_inst – [in] - Pointer to the menu editor instance.
ptr_menu_config – [in] - Pointer to the menu configuration structure.
- Returns:
Handle to the menu editor instance on success, or an error code.
-
rs_ret_val_t rs_menu_editor_process(rs_handle_t menu_handle)
Processes the menu editor operations.
This function manages the menu editor state and performs operations such as updating the menu display or handling user inputs.
- Parameters:
ptr_menu_inst – [in] - Pointer to the menu instance structure to be processed.
-
rs_ret_val_t rs_menu_editor_update_contents(rs_handle_t menu_handle)
-
void rs_menu_editor_refresh_lcd_contents(rs_handle_t handle)
Refreshes the LCD display based on the current menu state.
Refreshes the LCD contents for the menu editor.
This function updates the LCD screen to reflect the current state of the menu associated with the provided handle. It should be called when changes in the menu structure or content require a refresh on the display.
This function updates the LCD display with the latest information from the menu editor associated with the provided handle.
- Parameters:
handle – [in] - Handle to the menu instance that controls the LCD.
handle – [in] - Handle to the menu editor instance whose LCD contents need to be refreshed.
- Returns:
None.
- Returns:
This function does not return a value since it is a
void
function.
-
void rcb_keypad_action(rs_handle_t keypad_handle, uint8_t u8_key_index, uint8_t u8_key_state, uint16_t u16_press_time)
-
struct tag_rs_menu_list
- #include <rs_menu_editor.h>
Structure for the Menu list.
Public Members
-
char *ptr_label
Label of the menu.
-
uint16_t parent_index
Parent index of the menu.
-
uint16_t child_index
Child index of the menu.
-
uint16_t next_index
Next index of the menu.
-
uint16_t data_id
Data id of the menu.
-
uint8_t display_format1
Display format of the menu.
-
uint8_t prop
Property type of the menu.
-
uint8_t reserved
Reserved.
-
char *ptr_label
-
struct tag_rs_menu_config
- #include <rs_menu_editor.h>
Structure for the Menu configuration.
Public Members
-
uint8_t menu_type
Type of the menu (e.g., two or four lines)
-
uint8_t line_1_type
-
uint8_t line_2_type
-
uint8_t line_3_type
-
uint8_t line_4_type
-
rs_menu_list_t *ptr_menu_list_1
Pointer to the menu list 1 information.
-
rs_menu_list_t *ptr_menu_list_2
Pointer to the menu list 2 information.
-
rs_menu_list_t *ptr_menu_list_3
Pointer to the menu list 3 information.
-
rs_menu_list_t *ptr_menu_list_4
Pointer to the menu list 4 information.
-
uint32_t num_of_menu_list
Number of the menu list.
-
uint8_t menu_type
-
struct tag_rs_menu_instance
- #include <rs_menu_editor.h>
Structure for the Menu instance.
Public Members
-
rs_handle_t lcd_handle
Handle for the LCD display.
-
rs_handle_t keypad_handle
Handle for the keypad input.
-
rs_handle_t menu_handle
Handle for the menu editor instance.
-
rs_menu_config_t *ptr_menu_config
Pointer to the menu configuration.
-
uint16_t current_menu_index
Current menu index.
-
uint8_t line_1[RS_MENU_MAX_ARR_SIZE]
LCD’s line1 information.
-
uint8_t line_2[RS_MENU_MAX_ARR_SIZE]
LCD’s line2 information.
-
int8_t line1_cursor_pos
Cursor to move left and right.
-
int8_t line2_cursor_pos
Cursor to move left and right.
-
uint8_t mode
-
rs_handle_t lcd_handle