summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/StopWatch.h
diff options
context:
space:
mode:
authorKieran Cawthray <kieranc@gmail.com>2021-07-11 14:04:50 (GMT)
committerKieran Cawthray <kieranc@gmail.com>2021-07-11 14:04:50 (GMT)
commitf970dc9993d3d1ff108dbe9a70048571d8a6b53e (patch)
tree1293d181ecf545ff404fbb4eb120ff0b1877241d /src/displayapp/screens/StopWatch.h
parentf5639db8ed48a332eeeed48a359a3323b0537d39 (diff)
parent6a91b83b12ef849f68d54f490153b02f0ecf58dc (diff)
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-colorpicker
Diffstat (limited to 'src/displayapp/screens/StopWatch.h')
-rw-r--r--src/displayapp/screens/StopWatch.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h
index ff60436..e132f15 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;
};