diff options
Diffstat (limited to 'src/displayapp/screens/StopWatch.h')
-rw-r--r-- | src/displayapp/screens/StopWatch.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h index ff604361..e132f158 100644 --- a/src/displayapp/screens/StopWatch.h +++ b/src/displayapp/screens/StopWatch.h @@ -8,13 +8,12 @@ #include "portmacro_cmsis.h" #include <array> +#include "systemtask/SystemTask.h" namespace Pinetime::Applications::Screens { enum class States { Init, Running, Halted }; - enum class Events { Play, Pause, Stop }; - struct TimeSeparated_t { int mins; int secs; @@ -63,23 +62,28 @@ namespace Pinetime::Applications::Screens { class StopWatch : public Screen { public: - StopWatch(DisplayApp* app); + StopWatch(DisplayApp* app, System::SystemTask& systemTask); ~StopWatch() override; bool Refresh() override; void playPauseBtnEventHandler(lv_event_t event); void stopLapBtnEventHandler(lv_event_t event); + bool OnButtonPushed() override; + + void reset(); + void start(); + void pause(); private: + Pinetime::System::SystemTask& systemTask; + TickType_t timeElapsed; bool running; States currentState; - Events currentEvent; TickType_t startTime; TickType_t oldTimeElapsed; TimeSeparated_t currentTimeSeparated; // Holds Mins, Secs, millisecs LapTextBuffer_t<2> lapBuffer; - int lapNr; - bool lapPressed; + int lapNr = 0; lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap; lv_obj_t *lapOneText, *lapTwoText; }; |