InfiniTime.git

ref: fdc89f1a20889c0295534f58dc2e82ce8c55a18b

src/displayapp/screens/Metronome.h


 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
36
37
38
39
40
#pragma once

#include "systemtask/SystemTask.h"
#include "components/motor/MotorController.h"
#include "displayapp/screens/Screen.h"

namespace Pinetime {
  namespace Applications {
    namespace Screens {

      class Metronome : public Screen {
      public:
        Metronome(DisplayApp* app, Controllers::MotorController& motorController, System::SystemTask& systemTask);
        ~Metronome() override;
        void Refresh() override;
        void OnEvent(lv_obj_t* obj, lv_event_t event);
        bool OnTouchEvent(TouchEvents event) override;

      private:
        TickType_t startTime = 0;
        TickType_t tappedTime = 0;
        Controllers::MotorController& motorController;
        System::SystemTask& systemTask;
        int16_t bpm = 120;
        uint8_t bpb = 4;
        uint8_t counter = 1;

        bool metronomeStarted = false;
        bool allowExit = false;

        lv_obj_t *bpmArc, *bpmTap, *bpmValue;
        lv_obj_t *bpbDropdown, *currentBpbText;
        lv_obj_t* playPause;
        lv_obj_t* lblPlayPause;

        lv_task_t* taskRefresh;
      };
    }
  }
}