twali_app.h 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef TWALI_APP_H_INCLUDED
  2. #define TWALI_APP_H_INCLUDED
  3. #define TWALI_APP_MAIN_TASK 0
  4. #include "lvgl/lvgl.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. struct twali_task;
  9. enum twali_app_type {
  10. /* This app has only one screen, and is always active. E.g. a clock face. */
  11. twali_app_type_static = 1,
  12. /* This app can be started and stopped. E.g. a step counter.
  13. * If stopped, the app shows the start screen with the given icon.
  14. * If started it shows the active interface.
  15. */
  16. twali_app_type_dynamic = 2,
  17. };
  18. struct twali_app {
  19. const char * name;
  20. const char * icon_path;
  21. enum twali_app_type app_type;
  22. void * data;
  23. void (*update)(struct twali_app *t);
  24. struct {
  25. struct twali_task * task;
  26. lv_obj_t * screen;
  27. } private;
  28. };
  29. int twali_app_start(struct twali_app * a, int priority);
  30. int twali_app_stop(struct twali_app * a);
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif