flipp_pomodoro.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. uint8_t current_stage_index;
  13. uint32_t started_at_timestamp;
  14. } FlippPomodoroState;
  15. /// @brief Generates initial state
  16. /// @returns A new pre-populated state for pomodoro timer
  17. FlippPomodoroState* flipp_pomodoro__new();
  18. /// @brief Extract current stage of pomodoro
  19. /// @param state - pointer to the state of pomorodo
  20. /// @returns Current stage value
  21. PomodoroStage flipp_pomodoro__get_stage(FlippPomodoroState* state);
  22. /// @brief Destroys state of timer and it's dependencies
  23. void flipp_pomodoro__destroy(FlippPomodoroState* state);
  24. /// @brief Get remaining stage time.
  25. /// @param state - pointer to the state of pomorodo
  26. /// @returns Time difference to the end of current stage
  27. TimeDifference flipp_pomodoro__stage_remaining_duration(FlippPomodoroState* state);
  28. /// @brief Label of currently active stage
  29. /// @param state - pointer to the state of pomorodo
  30. /// @returns A string that explains current stage
  31. char* flipp_pomodoro__current_stage_label(FlippPomodoroState* state);
  32. /// @brief Label of transition to the next stage
  33. /// @param state - pointer to the state of pomorodo.
  34. /// @returns string with the label of the "skipp" button
  35. char* flipp_pomodoro__next_stage_label(FlippPomodoroState* state);
  36. /// @brief Check if current stage is expired
  37. /// @param state - pointer to the state of pomorodo.
  38. /// @returns expriations status - true means stage is expired
  39. bool flipp_pomodoro__is_stage_expired(FlippPomodoroState* state);
  40. /// @brief Rotate stage of the timer
  41. /// @param state - pointer to the state of pomorodo.
  42. void flipp_pomodoro__toggle_stage(FlippPomodoroState* state);