flipp_pomodoro.h 1.9 KB

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