#include #include #include #include "scenes.h" #include "liquid.h" #include "analog.h" #include "graphics/nokia.h" #include "graphics/drawing.h" /** * The struct is allocated bigger than 'Scene' to accommodate private fields. * Since the base struct is located at the beginning, it can be cast and passed around as Scene. */ struct RootScene { struct Scene base; }; static struct SceneEvent init(struct RootScene *self) { return SceneEvent_OpenChild(NewScene_MenuManual(), 0); // return SceneEvent_OpenChild(NewScene_Boot(), 1); // TODO swap } static struct SceneEvent onChildReturn(struct RootScene *self, uint32_t tag, int32_t status, void *data) { if (tag == 1) { return SceneEvent_OpenChild(NewScene_MenuManual(), 0); } // this should be unreachable return SceneEvent_None(); } static void paint(struct Scene *self) { LCD_clearDisplay(0); LCD_setStrEx("Press DEL to enter setup", 0, 0, BLACK, (struct TextStyle) {.size = FONT_BOLD}); } struct Scene *NewScene_Root(void) { struct RootScene *scene = calloc(1, sizeof(struct RootScene)); scene->base.init = (Scene_init_t) init; scene->base.onChildReturn = (Scene_onChildReturn_t) onChildReturn; scene->base.paint = paint; return (struct Scene *) scene; }