esmp3/include/controller.h

31 lines
668 B
C
Raw Normal View History

2019-08-02 21:48:36 +00:00
#pragma once
#include <Arduino.h>
2022-08-21 09:37:42 +00:00
#include <MFRC522v2.h>
#include <MFRC522Debug.h>
#include "esmp3.h"
#include "playlist.h"
2019-08-02 21:48:36 +00:00
class Controller {
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;
unsigned long last_button_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;
String read_rfid_data();
public:
void handle();
2022-08-21 09:37:42 +00:00
void next_track();
void prev_track();
void play();
void play(String rfid_id, bool shuffle=false);
2022-08-21 09:37:42 +00:00
void stop();
void eof_mp3();
};