acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
SdFat_example.ino (1607B)
1 //********************************************************************************************************** 2 //* audioI2S-- I2S audiodecoder for ESP32, SdFat example * 3 //********************************************************************************************************** 4 // 5 // first release on 05/2020 6 // updated on Sep. 27, 2021 7 /* 8 9 ⒈ install SdFat V2 from https://github.com/greiman/SdFat 10 ⒉ activate "SDFATFS_USED" in Audio.h 11 ⒊ activate "#define USE_UTF8_LONG_NAMES 1" in SdFatConfig.h 12 13 */ 14 15 #include "Arduino.h" 16 #include "Audio.h" 17 #include "SPI.h" 18 19 // Digital I/O used 20 #define SD_CS 5 21 #define SPI_MOSI 23 22 #define SPI_MISO 19 23 #define SPI_SCK 18 24 #define I2S_DOUT 25 25 #define I2S_BCLK 27 26 #define I2S_LRC 26 27 28 Audio audio; 29 30 void setup() { 31 pinMode(SD_CS, OUTPUT); digitalWrite(SD_CS, HIGH); 32 SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI); 33 SPI.setFrequency(1000000); 34 Serial.begin(115200); 35 SD.begin(SD_CS); 36 37 audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); 38 audio.setVolume(12); // 0...21 39 40 // audio.connecttoFS(SD, "test.mp3"); 41 audio.connecttoFS(SD, "良い一日私の友達.mp3"); 42 } 43 44 void loop() 45 { 46 audio.loop(); 47 } 48 49 // optional 50 void audio_info(const char *info){ 51 Serial.print("info "); Serial.println(info); 52 } 53 void audio_id3data(const char *info){ //id3 metadata 54 Serial.print("id3data ");Serial.println(info); 55 } 56 void audio_eof_mp3(const char *info){ //end of file 57 Serial.print("eof_mp3 ");Serial.println(info); 58 }