summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/StopWatch.h
blob: 9e5779a12f365ef21c5b6460cd38ba4d727cf501 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#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;
    void playPauseBtnEventHandler(lv_event_t event);


  private:
    const Pinetime::Controllers::DateTime& dateTime;
    bool running;
    States currentState;
    Events currentEvent;
    TickType_t startTime;
    TickType_t oldTimeElapsed;
    lv_obj_t *time, *msecTime, *btnPlayPause, *btnStop, *txtPlayPause, *txtStop;
  };
}