From cc58b635a34cf89fa6301096a19e0a816817aa50 Mon Sep 17 00:00:00 2001 From: panky-codes Date: Thu, 11 Mar 2021 10:54:14 +0100 Subject: Basic logic done. Need to change the timer source to get ms. Also need to replace with paddle app in displayApp.cpp and ApplicationList.cpp later. --- src/displayapp/screens/StopWatch.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/displayapp/screens/StopWatch.h (limited to 'src/displayapp/screens/StopWatch.h') diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h new file mode 100644 index 00000000..ecc1f276 --- /dev/null +++ b/src/displayapp/screens/StopWatch.h @@ -0,0 +1,33 @@ +#pragma once + +#include "Screen.h" +#include "components/datetime/DateTimeController.h" +#include "../LittleVgl.h" + +#include + +namespace Pinetime::Applications::Screens { + + enum class States { INIT, RUNNING, HALTED }; + + enum class Events { PLAY, PAUSE, STOP }; + + class StopWatch : public Screen { + public: + StopWatch(DisplayApp* app, const Pinetime::Controllers::DateTime& dateTime); + ~StopWatch() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(uint16_t x, uint16_t y) override; + + private: + using timeUnit = std::chrono::time_point; + const Pinetime::Controllers::DateTime& dateTime; + bool running; + States currentState; + Events currentEvent; + timeUnit startTime; + int64_t timeElapsed; + lv_obj_t *time, *msecTime; + }; +} \ No newline at end of file -- cgit v1.2.3