flipp_pomodoro.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #pragma once
  2. #include <furi_hal.h>
  3. #include "../helpers/time.h"
  4. /// @brief Options of pomodoro stages
  5. typedef enum
  6. {
  7. FlippPomodoroStageFocus,
  8. FlippPomodoroStageRest,
  9. FlippPomodoroStageLongBreak,
  10. } PomodoroStage;
  11. /// @brief State of the pomodoro timer
  12. typedef struct
  13. {
  14. PomodoroStage stage;
  15. uint8_t current_stage_index;
  16. uint32_t started_at_timestamp;
  17. } FlippPomodoroState;
  18. /// @brief Generates initial state
  19. /// @returns A new pre-populated state for pomodoro timer
  20. FlippPomodoroState *flipp_pomodoro__new();
  21. /// @brief Extract current stage of pomodoro
  22. /// @param state - pointer to the state of pomorodo
  23. /// @returns Current stage value
  24. PomodoroStage flipp_pomodoro__get_stage(FlippPomodoroState *state);
  25. /// @brief Destroys state of timer and it's dependencies
  26. void flipp_pomodoro__destroy(FlippPomodoroState *state);
  27. /// @brief Get remaining stage time.
  28. /// @param state - pointer to the state of pomorodo
  29. /// @returns Time difference to the end of current stage
  30. TimeDifference flipp_pomodoro__stage_remaining_duration(FlippPomodoroState *state);
  31. /// @brief Label of currently active stage
  32. /// @param state - pointer to the state of pomorodo
  33. /// @returns A string that explains current stage
  34. char *flipp_pomodoro__current_stage_label(FlippPomodoroState *state);
  35. /// @brief Label of transition to the next stage
  36. /// @param state - pointer to the state of pomorodo.
  37. /// @returns string with the label of the "skipp" button
  38. char *flipp_pomodoro__next_stage_label(FlippPomodoroState *state);
  39. /// @brief Check if current stage is expired
  40. /// @param state - pointer to the state of pomorodo.
  41. /// @returns expriations status - true means stage is expired
  42. bool flipp_pomodoro__is_stage_expired(FlippPomodoroState *state);
  43. /// @brief Rotate stage of the timer
  44. /// @param state - pointer to the state of pomorodo.
  45. void flipp_pomodoro__toggle_stage(FlippPomodoroState *state);