Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for Initialization Outside of Main #433

Open
@mikejr83

Description

I'm trying to get this library set-up so that I can initialize a rather complex menu structure in a separate file. How can I do this? It doesn't seem possible that I can return nav:

MenuConfig.cpp

Menu::navRoot CreateMenu()
{
 // create menu structure
 NAVROOT(nav, mainMenu, MAX_DEPTH, in, out);
 return nav;
}

main.cpp

Menu::navRoot nav = CreateMenu();
void setup(void) 
{
 // set up Serial, etc.
}
void loop(void)
{
 nav.poll();
}

I've tried several ways, like passing references, etc. The program seems to crash in the loop.

Is there a way to do this or do am I forced to have a gigantic main.cpp file?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /