94 void send_cmd_(uint8_t cmd, uint16_t high, uint16_t low) {
95 this->
send_cmd_(cmd, ((high & 0xFF) << 8) | (low & 0xFF));
109 #define DFPLAYER_SIMPLE_ACTION(ACTION_CLASS, ACTION_METHOD) \ 110 template<typename... Ts> \ 111 class ACTION_CLASS : \ 112 public Action<Ts...>, \ 113 public Parented<DFPlayer> { \ 114 void play(Ts... x) override { this->parent_->ACTION_METHOD(); } \ 124 void play(Ts...
x)
override {
125 auto file = this->file_.value(
x...);
132 TEMPLATABLE_VALUE(uint16_t, file)
133 TEMPLATABLE_VALUE(
bool, loop)
135 void play(Ts...
x)
override {
136 auto file = this->file_.value(x...);
137 auto loop = this->loop_.value(x...);
139 this->
parent_->play_file_loop(file);
141 this->
parent_->play_file(file);
148 TEMPLATABLE_VALUE(uint16_t, folder)
149 TEMPLATABLE_VALUE(uint16_t, file)
152 void play(Ts...
x)
override {
153 auto folder = this->folder_.value(x...);
154 auto file = this->file_.value(x...);
155 auto loop = this->loop_.value(x...);
157 this->
parent_->play_folder_loop(folder);
159 this->
parent_->play_folder(folder, file);
168 void play(Ts...
x)
override {
169 auto device = this->device_.value(
x...);
170 this->
parent_->set_device(device);
178 void play(Ts...
x)
override {
179 auto volume = this->volume_.value(
x...);
180 this->
parent_->set_volume(volume);
188 void play(Ts...
x)
override {
189 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)