瀏覽代碼

Disable interrupts while opening files from SD card

dds
PaulStoffregen 10 年之前
父節點
當前提交
0260ebf687
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. +2
    -0
      play_sd_raw.cpp
  2. +2
    -1
      play_sd_wav.cpp

+ 2
- 0
play_sd_raw.cpp 查看文件

@@ -38,7 +38,9 @@ void AudioPlaySdRaw::begin(void)
bool AudioPlaySdRaw::play(const char *filename)
{
stop();
__disable_irq();
rawfile = SD.open(filename);
__enable_irq();
if (!rawfile) {
//Serial.println("unable to open file");
return false;

+ 2
- 1
play_sd_wav.cpp 查看文件

@@ -59,8 +59,9 @@ void AudioPlaySdWav::begin(void)
bool AudioPlaySdWav::play(const char *filename)
{
stop();
// TODO: SD.open probably needs to be done with the audio interrupt disabled...
__disable_irq();
wavfile = SD.open(filename);
__enable_irq();
if (!wavfile) return false;
buffer_length = 0;
buffer_offset = 0;

Loading…
取消
儲存