#include "potatoe.h"
#include "XT_DAC_Audio.h
"
RTC_DATA_ATTR XT_DAC_Audio_Class DacAudio(25,0);
void print_wakeup_reason(){
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch(wakeup_reason)
{
case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); 播放音频();休息;
case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); 休息;
case ESP_SLEEP_WAKEUP_tiMER : Serial.println("定时器引起的唤醒"); 休息;
case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("触摸板引起的唤醒"); 休息;
case ESP_SLEEP_WAKEUP_ULP : Serial.println("由 ULP 程序引起的唤醒"); 休息;
默认值:Serial.printf(“唤醒不是由深度睡眠引起的:%dn”,wakeup_reason);休息;
void setup() {
Serial.begin(115200);
延迟(1000);
Serial.println("启动...");
//打印ESP32的唤醒原因
print_wakeup_reason();
esp_sleep_enable_ext0_wakeup(GPIO_NUM_33, 1);
esp_deep_sleep_start();
}
void loop() {
// 此处无事可做
}
void play_audio() {
DacAudio.FillBuffer();
DacAudio.Play(&土豆);
Serial.println("播放音频");
延迟(10000);
}
更多回帖