-
-
Notifications
You must be signed in to change notification settings - Fork 952
/
Metronome.h
52 lines (43 loc) · 1.44 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include "systemtask/SystemTask.h"
#include "systemtask/WakeLock.h"
#include "components/motor/MotorController.h"
#include "displayapp/screens/Screen.h"
#include "Symbols.h"
namespace Pinetime {
namespace Applications {
namespace Screens {
class Metronome : public Screen {
public:
Metronome(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::WakeLock wakeLock;
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;
};
}
template <>
struct AppTraits<Apps::Metronome> {
static constexpr Apps app = Apps::Metronome;
static constexpr const char* icon = Screens::Symbols::drum;
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
};
};
}
}