60 void send_cmd_(uint8_t cmd, uint16_t high, uint16_t low) {
61 this->
send_cmd_(cmd, ((high & 0xFF) << 8) | (low & 0xFF));
75 #define DFPLAYER_SIMPLE_ACTION(ACTION_CLASS, ACTION_METHOD) \ 76 template<typename... Ts> \ 77 class ACTION_CLASS : \ 78 public Action<Ts...>, \ 79 public Parented<DFPlayer> { \ 80 void play(Ts... x) override { this->parent_->ACTION_METHOD(); } \ 90 void play(Ts...
x)
override {
91 auto file = this->file_.value(
x...);
98 TEMPLATABLE_VALUE(uint16_t, file)
99 TEMPLATABLE_VALUE(
bool, loop)
101 void play(Ts...
x)
override {
102 auto file = this->file_.value(x...);
103 auto loop = this->loop_.value(x...);
105 this->
parent_->play_file_loop(file);
107 this->
parent_->play_file(file);
114 TEMPLATABLE_VALUE(uint16_t, folder)
115 TEMPLATABLE_VALUE(uint16_t, file)
118 void play(Ts...
x)
override {
119 auto folder = this->folder_.value(x...);
120 auto file = this->file_.value(x...);
121 auto loop = this->loop_.value(x...);
123 this->
parent_->play_folder_loop(folder);
125 this->
parent_->play_folder(folder, file);
134 void play(Ts...
x)
override {
135 auto device = this->device_.value(
x...);
136 this->
parent_->set_device(device);
144 void play(Ts...
x)
override {
145 auto volume = this->volume_.value(
x...);
146 this->
parent_->set_volume(volume);
154 void play(Ts...
x)
override {
155 auto eq = this->eq_.value(
x...);
void send_cmd_(uint8_t cmd, uint16_t argument=0)
void dump_config() override
bool check(Ts... x) override
CallbackManager< void()> on_finished_playback_callback_
void play_file_loop(uint16_t file)
void add_on_finished_playback_callback(std::function< void()> callback)
DFPLAYER_SIMPLE_ACTION(NextAction, next) DFPLAYER_SIMPLE_ACTION(PreviousAction
void set_device(Device device)
void send_cmd_(uint8_t cmd, uint16_t high, uint16_t low)
void play_file(uint16_t file)
void play_folder_loop(uint16_t folder)
TEMPLATABLE_VALUE(Device, device) void play(Ts... x) override
Base class for all automation conditions.
TEMPLATABLE_VALUE(uint16_t, file) void play(Ts... x) override
const size_t DFPLAYER_READ_BUFFER_LENGTH
void play_folder(uint16_t folder, uint16_t file)
TEMPLATABLE_VALUE(uint8_t, volume) void play(Ts... x) override
Implementation of SPI Controller mode.
void set_eq(EqPreset preset)
TEMPLATABLE_VALUE(EqPreset, eq) void play(Ts... x) override
void set_volume(uint8_t volume)
bool ack_reset_is_playing_
char read_buffer_[DFPLAYER_READ_BUFFER_LENGTH]
void play_mp3(uint16_t file)
Helper class to easily give an object a parent of type T.
DFPlayerFinishedPlaybackTrigger(DFPlayer *parent)