flipp_pomodoro.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <furi_hal.h>
  3. #include "../helpers/time.h"
  4. /// @brief Options of pomodoro stages
  5. typedef enum
  6. {
  7. Work,
  8. Rest,
  9. } PomodoroStage;
  10. /// @brief State of the pomodoro timer
  11. typedef struct
  12. {
  13. PomodoroStage stage;
  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 transition to the next stage
  30. /// @param state - pointer to the state of pomorodo.
  31. /// @returns string with the label of the "skipp" button
  32. char *flipp_pomodoro__next_stage_label(FlippPomodoroState *state);
  33. /// @brief Check if current stage is expired
  34. /// @param state - pointer to the state of pomorodo.
  35. /// @returns expriations status - true means stage is expired
  36. bool flipp_pomodoro__is_stage_expired(FlippPomodoroState *state);
  37. /// @brief Rotate stage of the timer
  38. /// @param state - pointer to the state of pomorodo.
  39. void flipp_pomodoro__toggle_stage(FlippPomodoroState *state);