screen.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * screen.h
  3. *
  4. * Created on: Jan 12, 2021
  5. * Author: David Original work by Jose (PTDreamer), 2017
  6. */
  7. #ifndef GRAPHICS_GUI_SCREEN_H_
  8. #define GRAPHICS_GUI_SCREEN_H_
  9. #include "main.h"
  10. #include "iron.h"
  11. #include "pid.h"
  12. #include "settings.h"
  13. #include "ssd1306.h"
  14. #include "widgets.h"
  15. #include "adc_global.h"
  16. #include "buzzer.h"
  17. #include "rotary_encoder.h"
  18. #include "tempsensors.h"
  19. #include "voltagesensors.h"
  20. enum {
  21. screen_boot,
  22. screen_main,
  23. screen_settingsmenu,
  24. screen_iron,
  25. screen_system,
  26. screen_reset,
  27. screen_reset_confirmation,
  28. screen_edit_iron_tips,
  29. screen_edit_tip_settings,
  30. screen_edit_tip_name,
  31. screen_edit_calibration,
  32. screen_edit_calibration_start,
  33. screen_edit_calibration_adjust,
  34. screen_edit_calibration_input,
  35. screen_debug,
  36. screen_debug2,
  37. };
  38. typedef struct screen_t screen_t;
  39. typedef enum{ screenRefresh_idle=0, screenRefresh_eraseNow, screenRefresh_alreadyErased} screenRefreshType;
  40. struct screen_t
  41. {
  42. struct screen_t *next_screen;
  43. widget_t *widgets;
  44. widget_t *current_widget;
  45. bool enabled;
  46. screenRefreshType refresh;
  47. int (*processInput)(struct screen_t *scr, RE_Rotation_t input, RE_State_t *);
  48. void (*update)(screen_t *scr);
  49. void (*draw)(screen_t *scr);
  50. void (*onExit)(screen_t *scr);
  51. void (*onEnter)(screen_t *scr);
  52. uint8_t index;
  53. void (*init)(screen_t *scr);
  54. };
  55. widget_t *screen_tabToWidget(screen_t * scr, uint8_t tab);
  56. void screen_addWidget(widget_t *widget, screen_t *scr);
  57. void default_screenDraw(screen_t *scr);
  58. int default_screenProcessInput(screen_t * scr, RE_Rotation_t input, RE_State_t *);
  59. void default_screenUpdate(screen_t *scr);
  60. void screen_setDefaults(screen_t *scr);
  61. void default_init(screen_t *scr);
  62. #endif /* GRAPHICS_GUI_SCREEN_H_ */