2019-08-02 21:48:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-08-06 18:50:11 +00:00
|
|
|
#include <Arduino.h>
|
2022-08-21 09:37:42 +00:00
|
|
|
#include <MFRC522v2.h>
|
|
|
|
#include <MFRC522Debug.h>
|
|
|
|
#include "esmp3.h"
|
|
|
|
#include "playlist.h"
|
2019-11-14 19:42:02 +00:00
|
|
|
|
2019-08-02 21:48:36 +00:00
|
|
|
class Controller {
|
2022-08-19 08:37:03 +00:00
|
|
|
private:
|
|
|
|
void handle_buttons();
|
|
|
|
void handle_rfid();
|
2022-08-21 09:37:42 +00:00
|
|
|
bool is_button_pressed(uint8_t pin);
|
|
|
|
Playlist current_playlist;
|
|
|
|
bool is_rfid_present = false;
|
|
|
|
unsigned long last_rfid_check = 0;
|
2022-08-21 12:00:52 +00:00
|
|
|
uint8_t button_pressed = 0;
|
|
|
|
unsigned long button_pressed_since = 0;
|
|
|
|
bool button_already_processed = false;
|
2022-08-19 08:37:03 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
void handle();
|
2022-08-21 09:37:42 +00:00
|
|
|
void next_track();
|
|
|
|
void prev_track();
|
|
|
|
void play();
|
|
|
|
void play(String rfid_id);
|
|
|
|
void stop();
|
2022-08-19 08:37:03 +00:00
|
|
|
};
|