main.c 955 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <stdio.h>
  2. #include <furi.h>
  3. #include <gui/gui.h>
  4. #include "main.h"
  5. #include "scenes/register.h"
  6. int main() {
  7. App* app = malloc(sizeof(App));
  8. furi_assert(app != NULL, "Failed to allocate memory for the app");
  9. Gui* gui = furi_record_open(RECORD_GUI);
  10. furi_assert(gui != NULL, "Failed to open the GUI record");
  11. register_scenes(app);
  12. view_dispatcher_attach_to_gui(app->view_dispatcher, gui, ViewDispatcherTypeFullscreen);
  13. // The default scene is always the first one!
  14. scene_manager_next_scene(app->scene_manager, 0);
  15. view_dispatcher_switch_to_view(app->view_dispatcher, 0);
  16. view_dispatcher_run(app->view_dispatcher);
  17. FURI_LOG_I("DemoApp", "Exiting application.");
  18. free_scenes(app);
  19. FURI_LOG_I("DemoApp", "Freed app.");
  20. return 0;
  21. }
  22. // Stub entrypoint due to gcc complaining about
  23. // mismatching main function signature.
  24. int32_t entrypoint(void* p) {
  25. UNUSED(p);
  26. return main();
  27. }