removed codecs to save memory
This commit is contained in:
94
lib/ESP32-audioI2S/examples/Ethernet/ETH_IP101.ino
Normal file
94
lib/ESP32-audioI2S/examples/Ethernet/ETH_IP101.ino
Normal file
@@ -0,0 +1,94 @@
|
||||
#include "Arduino.h"
|
||||
#include "Audio.h"
|
||||
#include "ETH.h"
|
||||
|
||||
#define ETHERNET_IF
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define I2S_DOUT 25
|
||||
#define I2S_BCLK 27
|
||||
#define I2S_LRC 26
|
||||
#define ETH_PHY_TYPE ETH_PHY_TLK110
|
||||
#define ETH_PHY_MDC 23
|
||||
#define ETH_PHY_MDIO 18
|
||||
#define ETH_PHY_POWER -1
|
||||
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32P4
|
||||
#define I2S_DOUT 22
|
||||
#define I2S_BCLK 20
|
||||
#define I2S_LRC 21
|
||||
#define ETH_PHY_TYPE ETH_PHY_TLK110
|
||||
#define ETH_PHY_MDC 31
|
||||
#define ETH_PHY_MDIO 52
|
||||
#define ETH_PHY_POWER 51
|
||||
#define ETH_CLK_MODE EMAC_CLK_EXT_IN
|
||||
#endif
|
||||
|
||||
Audio audio;
|
||||
|
||||
static bool eth_connected = false;
|
||||
|
||||
void onEvent(arduino_event_id_t event) {
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
Serial.println("ETH Started");
|
||||
// The hostname must be set after the interface is started, but needs
|
||||
// to be set before DHCP, so set it from the event handler thread.
|
||||
ETH.setHostname("esp32-ethernet");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_CONNECTED: Serial.println("ETH Connected"); break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP:
|
||||
Serial.println("ETH Got IP");
|
||||
Serial.println(ETH);
|
||||
eth_connected = true;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_LOST_IP:
|
||||
Serial.println("ETH Lost IP");
|
||||
eth_connected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
Serial.println("ETH Disconnected");
|
||||
eth_connected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
Serial.println("ETH Stopped");
|
||||
eth_connected = false;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.print("A\n\n");
|
||||
Serial.println("----------------------------------");
|
||||
Serial.printf("ESP32 Chip: %s\n", ESP.getChipModel());
|
||||
Serial.printf("Arduino Version: %d.%d.%d\n", ESP_ARDUINO_VERSION_MAJOR, ESP_ARDUINO_VERSION_MINOR, ESP_ARDUINO_VERSION_PATCH);
|
||||
Serial.printf("ESP-IDF Version: %d.%d.%d\n", ESP_IDF_VERSION_MAJOR, ESP_IDF_VERSION_MINOR, ESP_IDF_VERSION_PATCH);
|
||||
Serial.printf("ARDUINO_LOOP_STACK_SIZE %d words (32 bit)\n", CONFIG_ARDUINO_LOOP_STACK_SIZE);
|
||||
Serial.println("----------------------------------");
|
||||
Serial.print("\n\n");
|
||||
Network.onEvent(onEvent);
|
||||
ETH.begin();
|
||||
while (!eth_connected) delay(100);
|
||||
Serial.println("ETH Connected");
|
||||
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
||||
audio.setVolume(21); // default 0...21
|
||||
audio.connecttohost("http://stream.antennethueringen.de/live/aac-64/stream.antennethueringen.de/"); // aac
|
||||
pinMode(53, OUTPUT);
|
||||
digitalWrite(53, HIGH);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
audio.loop();
|
||||
vTaskDelay(1);
|
||||
}
|
||||
|
||||
// optional
|
||||
void audio_info(const char *info){
|
||||
Serial.print("info "); Serial.println(info);
|
||||
}
|
||||
|
||||
74
lib/ESP32-audioI2S/examples/Ethernet/ETH_W5500.ino
Normal file
74
lib/ESP32-audioI2S/examples/Ethernet/ETH_W5500.ino
Normal file
@@ -0,0 +1,74 @@
|
||||
#include "Arduino.h" // >= Arduino V3
|
||||
#include <ETH.h>
|
||||
#include <SPI.h>
|
||||
#define ETHERNET_IF
|
||||
#include "Audio.h"
|
||||
|
||||
Audio audio;
|
||||
|
||||
#define USE_TWO_ETH_PORTS 0
|
||||
#define ETH_PHY_TYPE ETH_PHY_W5500
|
||||
|
||||
// GPIOs
|
||||
#define ETH_PHY_ADDR 1
|
||||
#define ETH_PHY_CS 3
|
||||
#define ETH_PHY_IRQ 8
|
||||
#define ETH_PHY_RST 4
|
||||
#define ETH_SPI_SCK 7
|
||||
#define ETH_SPI_MISO 6
|
||||
#define ETH_SPI_MOSI 5
|
||||
#define I2S_DOUT 12
|
||||
#define I2S_BCLK 13
|
||||
#define I2S_LRC 14
|
||||
|
||||
static bool eth_connected = false;
|
||||
|
||||
void onEvent(arduino_event_id_t event, arduino_event_info_t info) {
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
Serial.println("ETH Started");
|
||||
ETH.setHostname("esp32-eth0"); //set eth hostname here
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_CONNECTED: Serial.println("ETH Connected"); break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP: Serial.printf("ETH Got IP: '%s'\n", esp_netif_get_desc(info.got_ip.esp_netif)); Serial.println(ETH);
|
||||
eth_connected = true;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_LOST_IP:
|
||||
Serial.println("ETH Lost IP");
|
||||
eth_connected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
Serial.println("ETH Disconnected");
|
||||
eth_connected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
Serial.println("ETH Stopped");
|
||||
eth_connected = false;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
Serial.print("\n\n");
|
||||
|
||||
Network.onEvent(onEvent);
|
||||
|
||||
SPI.begin(ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI);
|
||||
ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI);
|
||||
while (!eth_connected) delay(100);
|
||||
|
||||
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
||||
audio.setVolume(21); // default 0...21
|
||||
audio.connecttohost("https://wdr-wdr2-ruhrgebiet.icecastssl.wdr.de/wdr/wdr2/ruhrgebiet/mp3/128/stream.mp3"); // mp3
|
||||
}
|
||||
|
||||
void loop(){
|
||||
audio.loop();
|
||||
vTaskDelay(5 /portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
void audio_info(const char *info){
|
||||
Serial.print("info "); Serial.println(info);
|
||||
}
|
||||
88
lib/ESP32-audioI2S/examples/Ethernet/WT32-ETH01.ino
Normal file
88
lib/ESP32-audioI2S/examples/Ethernet/WT32-ETH01.ino
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Audio.h"
|
||||
#include "SD.h"
|
||||
#include "FS.h"
|
||||
|
||||
// Digital I/O used
|
||||
#define SD_CS 5
|
||||
#define SPI_MOSI 2
|
||||
#define SPI_MISO 4
|
||||
#define SPI_SCK 17
|
||||
#define I2S_DOUT 12
|
||||
#define I2S_BCLK 14
|
||||
#define I2S_LRC 15
|
||||
|
||||
#define ETHERNET_IF
|
||||
#define ETH_PHY_TYPE ETH_PHY_LAN8720
|
||||
#define ETH_PHY_MDC 23
|
||||
#define ETH_PHY_MDIO 18
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32P4
|
||||
#define ETH_CLK_MODE EMAC_CLK_EXT_IN
|
||||
#endif
|
||||
|
||||
#include "ETH.h"
|
||||
|
||||
Audio audio;
|
||||
|
||||
static bool eth_connected = false;
|
||||
|
||||
void onEvent(arduino_event_id_t event) {
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
Serial.println("ETH Started");
|
||||
// The hostname must be set after the interface is started, but needs
|
||||
// to be set before DHCP, so set it from the event handler thread.
|
||||
ETH.setHostname("esp32-ethernet");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_CONNECTED: Serial.println("ETH Connected"); break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP:
|
||||
Serial.println("ETH Got IP");
|
||||
Serial.println(ETH);
|
||||
eth_connected = true;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_LOST_IP:
|
||||
Serial.println("ETH Lost IP");
|
||||
eth_connected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
Serial.println("ETH Disconnected");
|
||||
eth_connected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
Serial.println("ETH Stopped");
|
||||
eth_connected = false;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(SD_CS, OUTPUT); digitalWrite(SD_CS, HIGH);
|
||||
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
||||
Serial.begin(115200);
|
||||
SD.begin(SD_CS);
|
||||
|
||||
Network.onEvent(onEvent);
|
||||
ETH.begin();
|
||||
while (!eth_connected) delay(100);
|
||||
// Eth Connected,
|
||||
|
||||
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
||||
audio.setVolume(21); // default 0...21
|
||||
audio.connecttohost("https://wdr-wdr2-ruhrgebiet.icecastssl.wdr.de/wdr/wdr2/ruhrgebiet/mp3/128/stream.mp3"); // mp3
|
||||
}
|
||||
|
||||
void loop(){
|
||||
vTaskDelay(1);
|
||||
audio.loop();
|
||||
}
|
||||
|
||||
void audio_info(const char *info){
|
||||
Serial.print("info "); Serial.println(info);
|
||||
}
|
||||
Reference in New Issue
Block a user