Add pre-packaged dependency libraries (ESP32-audioI2S and PNGdec)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// Copied from https://github.com/LilyGO/TTGO-TAudio/issues/12
|
||||
|
||||
|
||||
// Required Libraries (Download zips and add to the Arduino IDE library).
|
||||
#include "Arduino.h"
|
||||
#include <WM8978.h> // https://github.com/CelliesProjects/wm8978-esp32
|
||||
#include <Audio.h> // https://github.com/schreibfaul1/ESP32-audioI2S
|
||||
|
||||
// T-Audio 1.6 WM8978 I2C pins.
|
||||
#define I2C_SDA 19
|
||||
#define I2C_SCL 18
|
||||
|
||||
// T-Audio 1.6 WM8978 I2S pins.
|
||||
#define I2S_BCK 33
|
||||
#define I2S_WS 25
|
||||
#define I2S_DOUT 26
|
||||
|
||||
// T-Audio 1.6 WM8978 MCLK gpio number
|
||||
#define I2S_MCLKPIN 0
|
||||
|
||||
Audio audio;
|
||||
WM8978 dac;
|
||||
|
||||
void my_audio_info(Audio::msg_t m) {
|
||||
Serial.printf("%s: %s\n", m.s, m.msg);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Audio::audio_info_callback = my_audio_info;
|
||||
Serial.begin(115200);
|
||||
|
||||
// Setup wm8978 I2C interface.
|
||||
if (!dac.begin(I2C_SDA, I2C_SCL)) {
|
||||
ESP_LOGE(TAG, "Error setting up dac: System halted.");
|
||||
while (1) delay(100);
|
||||
}
|
||||
|
||||
// Select I2S pins
|
||||
audio.setPinout(I2S_BCK, I2S_WS, I2S_DOUT);
|
||||
audio.i2s_mclk_pin_select(I2S_MCLKPIN);
|
||||
|
||||
// WiFi Settings here.
|
||||
WiFi.begin("EnterSSIDHere", "EnterPasswordHere");
|
||||
while (!WiFi.isConnected()) {
|
||||
delay(10);
|
||||
}
|
||||
ESP_LOGI(TAG, "Connected. Starting MP3...");
|
||||
// Enter your Icecast station URL here.
|
||||
audio.setVolume(21);
|
||||
audio.connecttohost("http://hestia2.cdnstream.com/1458_128");
|
||||
// Volume control.
|
||||
dac.setSPKvol(63); // Change volume here for board speaker output (Max 63).
|
||||
dac.setHPvol(63, 63); // Change volume here for headphone jack left, right channel.
|
||||
}
|
||||
|
||||
void loop() {
|
||||
vTaskDelay(1);
|
||||
audio.loop();
|
||||
}
|
||||
BIN
libraries/ESP32-audioI2S/examples/ESP32_TTGO-TAudio/T9V1.5.jpg
Normal file
BIN
libraries/ESP32-audioI2S/examples/ESP32_TTGO-TAudio/T9V1.5.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 271 KiB |
Binary file not shown.
Reference in New Issue
Block a user