Skip to content

Commit 78ba1ea

Browse files
committed
support for SdSpiConfig in AudioSourceSdFat
1 parent b162169 commit 78ba1ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/AudioTools/AudioPlayer.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ namespace audio_tools {
169169
*/
170170
class AudioSourceSdFat : public AudioSource {
171171
public:
172+
/// Default constructor
172173
AudioSourceSdFat(const char* startFilePath = "/", const char* ext = ".mp3", int chipSelect = PIN_CS, int speedMHz = 2) {
173174
LOGD(LOG_METHOD);
174175
LOGI("SD chipSelect: %d", chipSelect);
@@ -180,6 +181,15 @@ namespace audio_tools {
180181
exension = ext;
181182
}
182183

184+
/// Costructor with SdSpiConfig
185+
AudioSourceSdFat(const char* startFilePath, const char* ext, SdSpiConfig &config) {
186+
LOGD(LOG_METHOD);
187+
if (!sd.begin(config)) {
188+
LOGE("SD.begin failed");
189+
}
190+
start_path = startFilePath;
191+
exension = ext;
192+
}
183193
virtual void begin() override {
184194
LOGD(LOG_METHOD);
185195
idx_pos = 0;

0 commit comments

Comments
 (0)