2021-06-12 15:06:58 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "systemtask/SystemTask.h"
|
|
|
|
#include "components/motor/MotorController.h"
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
|
|
|
namespace Pinetime::Applications::Screens {
|
|
|
|
|
|
|
|
class Metronome : public Screen {
|
|
|
|
public:
|
|
|
|
Metronome(DisplayApp* app, Controllers::MotorController& motorController, System::SystemTask& systemTask);
|
|
|
|
~Metronome() override;
|
2021-07-19 15:26:12 +02:00
|
|
|
void Refresh() override;
|
2021-06-12 15:06:58 +02:00
|
|
|
bool OnTouchEvent(TouchEvents event) override;
|
|
|
|
void OnEvent(lv_obj_t* obj, lv_event_t event);
|
|
|
|
enum class States { Running, Stopped };
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool running;
|
|
|
|
States currentState;
|
|
|
|
TickType_t startTime;
|
|
|
|
TickType_t tappedTime = 0;
|
|
|
|
Controllers::MotorController& motorController;
|
|
|
|
System::SystemTask& systemTask;
|
|
|
|
uint16_t bpm = 120;
|
|
|
|
uint8_t bpb = 4;
|
|
|
|
uint8_t counter = 1;
|
|
|
|
|
|
|
|
lv_obj_t *bpmArc, *bpmTap, *bpmValue, *bpmLegend;
|
|
|
|
lv_obj_t *bpbDropdown, *bpbLegend;
|
|
|
|
lv_obj_t *playPause, *playPauseLabel;
|
2021-07-19 15:26:12 +02:00
|
|
|
|
|
|
|
lv_task_t* taskRefresh;
|
2021-06-12 15:06:58 +02:00
|
|
|
};
|
|
|
|
}
|