1
0
Fork 0
InfiniTime/src/displayapp/screens/StopWatch.h

35 lines
908 B
C
Raw Normal View History

#pragma once
#include "Screen.h"
#include "components/datetime/DateTimeController.h"
#include "../LittleVgl.h"
#include "FreeRTOS.h"
#include "portmacro_cmsis.h"
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;
2021-03-11 23:41:24 +01:00
void playPauseBtnEventHandler(lv_event_t event);
private:
const Pinetime::Controllers::DateTime& dateTime;
bool running;
States currentState;
Events currentEvent;
TickType_t startTime;
2021-03-11 23:41:24 +01:00
TickType_t oldTimeElapsed;
lv_obj_t *time, *msecTime, *btnPlayPause, *btnStop, *txtPlayPause, *txtStop;
};
}