2021-03-11 10:54:14 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Screen.h"
|
|
|
|
#include "components/datetime/DateTimeController.h"
|
|
|
|
#include "../LittleVgl.h"
|
|
|
|
|
2021-03-11 11:56:58 +01:00
|
|
|
#include "FreeRTOS.h"
|
|
|
|
#include "portmacro_cmsis.h"
|
2021-03-11 10:54:14 +01:00
|
|
|
|
|
|
|
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:
|
|
|
|
const Pinetime::Controllers::DateTime& dateTime;
|
|
|
|
bool running;
|
|
|
|
States currentState;
|
|
|
|
Events currentEvent;
|
2021-03-11 11:56:58 +01:00
|
|
|
TickType_t startTime;
|
|
|
|
TickType_t timeElapsed;
|
2021-03-11 10:54:14 +01:00
|
|
|
lv_obj_t *time, *msecTime;
|
|
|
|
};
|
|
|
|
}
|