Advertisement
Guest User

Untitled

a guest
Jan 17th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. When I had this it worked fine:
  2.  
  3. // Define menu stacks like this
  4. static const menu_stack_t logoMenu = {
  5. .menuDepth = 1,
  6. .rows = {{ .menuFunction = &display_logo }},
  7. };
  8.  
  9. // declare and array to hold them
  10. menu_stack_t columns[10];
  11.  
  12. columns[0] = logoMenu;
  13. columns[1] = gainsMenu;
  14. columns[2] = metersMenu;
  15. ...
  16.  
  17. //and access like this:
  18. if(columns[mainMenu.columnId].rows[mainMenu.rowId].preDisplayFunction != NULL ){
  19. columns[mainMenu.columnId].rows[mainMenu.rowId].preDisplayFunction();
  20. }
  21.  
  22. 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
  23.  
  24. so I want to make columns into an array of pointers to structs:
  25.  
  26. static const menu_stack_t *columns[]{
  27. &logoMenu,
  28. &gainsMenu,
  29. &metersMenu,
  30. ...
  31. };
  32.  
  33. and then access I think I access it:
  34.  
  35. if(columns[mainMenu.columnId]->rows[mainMenu.rowId].preDisplayFunction != NULL ){
  36. columns[mainMenu.columnId]->rows[mainMenu.rowId].preDisplayFunction();
  37. }
  38.  
  39. 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