InfiniTime/src/displayapp/screens/StopWatch.h

50 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include "displayapp/screens/Screen.h"
#include <lvgl/lvgl.h>
#include <FreeRTOS.h>
#include "portmacro_cmsis.h"
#include "systemtask/SystemTask.h"
namespace Pinetime::Applications::Screens {
2021-03-20 21:42:13 +00:00
enum class States { Init, Running, Halted };
struct TimeSeparated_t {
int mins;
int secs;
int hundredths;
};
class StopWatch : public Screen {
public:
StopWatch(DisplayApp* app, System::SystemTask& systemTask);
~StopWatch() override;
2021-07-19 13:26:12 +00:00
void Refresh() override;
2021-03-11 22:41:24 +00:00
void playPauseBtnEventHandler(lv_event_t event);
void stopLapBtnEventHandler(lv_event_t event);
bool OnButtonPushed() override;
2022-04-09 10:57:58 +00:00
void Reset();
void Start();
void Pause();
private:
Pinetime::System::SystemTask& systemTask;
States currentState = States::Init;
TickType_t startTime;
TickType_t oldTimeElapsed = 0;
static constexpr int maxLapCount = 20;
TickType_t laps[maxLapCount + 1];
static constexpr int displayedLaps = 2;
int lapsDone = 0;
lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap;
lv_obj_t* lapText;
2021-07-19 13:26:12 +00:00
lv_task_t* taskRefresh;
};
2021-03-15 20:35:36 +00:00
}