31 lines
668 B
C++
31 lines
668 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <MFRC522v2.h>
|
|
#include <MFRC522Debug.h>
|
|
#include "esmp3.h"
|
|
#include "playlist.h"
|
|
|
|
class Controller {
|
|
private:
|
|
void handle_buttons();
|
|
void handle_rfid();
|
|
bool is_button_pressed(uint8_t pin);
|
|
Playlist current_playlist;
|
|
bool is_rfid_present = false;
|
|
unsigned long last_rfid_check = 0;
|
|
unsigned long last_button_check = 0;
|
|
uint8_t button_pressed = 0;
|
|
unsigned long button_pressed_since = 0;
|
|
bool button_already_processed = false;
|
|
String read_rfid_data();
|
|
|
|
public:
|
|
void handle();
|
|
void next_track();
|
|
void prev_track();
|
|
void play();
|
|
void play(String rfid_id, bool shuffle=false);
|
|
void stop();
|
|
void eof_mp3();
|
|
}; |