Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- When I had this it worked fine:
- // Define menu stacks like this
- static const menu_stack_t logoMenu = {
- .menuDepth = 1,
- .rows = {{ .menuFunction = &display_logo }},
- };
- // declare and array to hold them
- menu_stack_t columns[10];
- columns[0] = logoMenu;
- columns[1] = gainsMenu;
- columns[2] = metersMenu;
- ...
- //and access like this:
- if(columns[mainMenu.columnId].rows[mainMenu.rowId].preDisplayFunction != NULL ){
- columns[mainMenu.columnId].rows[mainMenu.rowId].preDisplayFunction();
- }
- But, I think this means I am using space twice, and columns will be getting a copy of the struct, and I need to save memory
- so I want to make columns into an array of pointers to structs:
- static const menu_stack_t *columns[]{
- &logoMenu,
- &gainsMenu,
- &metersMenu,
- ...
- };
- and then access I think I access it:
- if(columns[mainMenu.columnId]->rows[mainMenu.rowId].preDisplayFunction != NULL ){
- columns[mainMenu.columnId]->rows[mainMenu.rowId].preDisplayFunction();
- }
- But when I fire up the debugger on the embedded target, the array appears to be full of junk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement