diff --git a/README.md b/README.md index ad24f74..a80f3eb 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ This [**MDNS_Generic library**](https://github.com/khoih-prog/MDNS_Generic) is b 2. [`Arduino AVR core 1.8.5+`](https://github.com/arduino/ArduinoCore-avr) for Arduino (Use Arduino Board Manager) for AVR boards. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-avr.svg)](https://github.com/arduino/ArduinoCore-avr/releases/latest) 3. [`Teensy core v1.56+`](https://www.pjrc.com/teensy/td_download.html) for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0) boards. 4. [`Arduino SAM DUE core v1.6.12+`](https://github.com/arduino/ArduinoCore-sam) for SAM DUE ARM Cortex-M3 boards. - 5. [`Arduino SAMD core 1.8.12+`](https://github.com/arduino/ArduinoCore-samd) for SAMD ARM Cortex-M0+ boards. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-samd.svg)](https://github.com/arduino/ArduinoCore-samd/releases/latest) + 5. [`Arduino SAMD core 1.8.13+`](https://github.com/arduino/ArduinoCore-samd) for SAMD ARM Cortex-M0+ boards. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-samd.svg)](https://github.com/arduino/ArduinoCore-samd/releases/latest) 6. [`Adafruit SAMD core 1.7.10+`](https://github.com/adafruit/ArduinoCore-samd) for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). [![GitHub release](https://img.shields.io/github/release/adafruit/ArduinoCore-samd.svg)](https://github.com/adafruit/ArduinoCore-samd/releases/latest) 7. [`Seeeduino SAMD core 1.8.2+`](https://github.com/Seeed-Studio/ArduinoCore-samd) for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). [![Latest release](https://img.shields.io/github/release/Seeed-Studio/ArduinoCore-samd.svg)](https://github.com/Seeed-Studio/ArduinoCore-samd/releases/latest/) 8. [`Adafruit nRF52 v1.3.0`](https://github.com/adafruit/Adafruit_nRF52_Arduino) for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, **NINA_B302_ublox**, etc. [![GitHub release](https://img.shields.io/github/release/adafruit/Adafruit_nRF52_Arduino.svg)](https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/latest) @@ -203,7 +203,7 @@ This [**MDNS_Generic library**](https://github.com/khoih-prog/MDNS_Generic) is b 13. Depending on which Ethernet module/shield you're using : - [`Ethernet_Generic library v2.0.1+`](https://github.com/khoih-prog/Ethernet_Generic) for W5100, W5200 and W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip. [![GitHub release](https://img.shields.io/github/release/khoih-prog/Ethernet_Generic.svg)](https://github.com/khoih-prog/Ethernet_Generic/releases/latest) -14. [`STM32Ethernet library v1.2.0+`](https://github.com/stm32duino/STM32Ethernet) for built-in LAN8742A Ethernet on (Nucleo-144, Discovery). [![GitHub release](https://img.shields.io/github/release/stm32duino/STM32Ethernet.svg)](https://github.com/stm32duino/STM32Ethernet/releases/latest). To be used with [`LwIP library v2.1.2+`](https://github.com/stm32duino/LwIP). [![GitHub release](https://img.shields.io/github/release/stm32duino/LwIP.svg)](https://github.com/stm32duino/LwIP/releases/latest). **Not yet ready** in v1.4.0. +14. [`STM32Ethernet library v1.2.0+`](https://github.com/stm32duino/STM32Ethernet) for built-in LAN8742A Ethernet on (Nucleo-144, Discovery). [![GitHub release](https://img.shields.io/github/release/stm32duino/STM32Ethernet.svg)](https://github.com/stm32duino/STM32Ethernet/releases/latest). To be used with [`LwIP library v2.1.2+`](https://github.com/stm32duino/LwIP). [![GitHub release](https://img.shields.io/github/release/stm32duino/LwIP.svg)](https://github.com/stm32duino/LwIP/releases/latest). **Not yet ready** in v1.4.1 15. [`WiFiNINA_Generic library v1.8.14-3+`](https://github.com/khoih-prog/WiFiNINA_Generic). To install. check [![arduino-library-badge](https://www.ardu-badge.com/badge/WiFiNINA_Generic.svg?)](https://www.ardu-badge.com/WiFiNINA_Generic) if using WiFiNINA for boards such as Nano 33 IoT, nRF52, Teensy, etc. 16. [`Modified WiFi101 Library v0.16.1+`](https://github.com/khoih-prog/WiFi101) to use SAMD MKR1000, etc. boards with WiFi101. @@ -739,593 +739,12 @@ mdns.startDiscoveringService(serviceName, MDNSServiceTCP, 5000); #### 1. File [ResolvingHostNames.ino](examples/Ethernet/ResolvingHostNames/ResolvingHostNames.ino) -```cpp -// Illustrates how to resolve host names via MDNS (Multicast DNS) - -#include "defines.h" - -// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error -#include - -EthernetUDP udp; -MDNS mdns(udp); - -void nameFound(const char* name, IPAddress ip); - -void setup() -{ - Serial.begin(115200); - while (!Serial); - - Serial.print("\nStart ResolvingHostNames on "); Serial.print(BOARD_NAME); - Serial.print(" using "); Serial.println(SHIELD_TYPE); - Serial.println(MDNS_GENERIC_VERSION); - - Serial.println(("=========================")); - Serial.println(("Default SPI pinout:")); - Serial.print("MOSI:"); - Serial.println(MOSI); - Serial.print("MISO:"); - Serial.println(MISO); - Serial.print("SCK:"); - Serial.println(SCK); - Serial.print("SS:"); - Serial.println(SS); - Serial.println(("=========================")); - - // unknown board, do nothing, use default SS = 10 -#ifndef USE_THIS_SS_PIN - #define USE_THIS_SS_PIN 10 // For other boards -#endif - - MDNS_LOGERROR3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN); - - // For other boards, to change if necessary - #if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 ) - // Must use library patch for Ethernet, Ethernet2, EthernetLarge libraries - - Ethernet.init (USE_THIS_SS_PIN); - - #elif USE_ETHERNET3 - // Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer - #ifndef ETHERNET3_MAX_SOCK_NUM - #define ETHERNET3_MAX_SOCK_NUM 4 - #endif - - Ethernet.setCsPin (USE_THIS_SS_PIN); - Ethernet.init (ETHERNET3_MAX_SOCK_NUM); - - #endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE ) - - // start the ethernet connection and the server: - // Use Static IP - //Ethernet.begin(mac, ip); - // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - - Ethernet.begin(mac[index]); - - // Just info to know how to connect correctly - Serial.println("========================="); - Serial.println("Currently Used SPI pinout:"); - Serial.print("MOSI:"); - Serial.println(MOSI); - Serial.print("MISO:"); - Serial.println(MISO); - Serial.print("SCK:"); - Serial.println(SCK); - Serial.print("SS:"); - Serial.println(SS); - Serial.println("========================="); - - Serial.print("Using mac index = "); - Serial.println(index); - - Serial.print("Connected! IP address: "); - Serial.println(Ethernet.localIP()); - - // Initialize the mDNS library. You can now reach or ping this - // Arduino via the host name "arduino.local", provided that your operating - // system is mDNS/Bonjour-enabled (such as MacOS X). - // Always call this before any other method! - String hostname = String(BOARD_NAME) + "_" + String(index); - - //hostname.toUpperCase(); - hostname.toLowerCase(); - hostname.replace(" ", "-"); - hostname.replace("_", "-"); - - Serial.print("Registering mDNS hostname: "); Serial.println(hostname); - Serial.print("To access, using "); Serial.print(hostname); Serial.println(".local"); - - mdns.begin(Ethernet.localIP(), hostname.c_str()); - - // We specify the function that the mDNS library will call when it - // resolves a host name. In this case, we will call the function named - // "nameFound". - mdns.setNameResolvedCallback(nameFound); - - Serial.println("Enter a mDNS host name via the Arduino Serial Monitor to have it resolved."); - Serial.println("Do not postfix the name with \".local\""); -} - -void loop() -{ - static char hostName[256]; - //char hostName[512]; - - uint8_t length = 0; - - // read in a host name from the Arduino IDE's serial monitor. - while (Serial.available()) - { - hostName[length] = Serial.read(); - length = (length + 1) % 256; - delay(5); - } - - // Terminal adds "\r\n", need to remove - if (length > 1) - length = (length - 2) % 256; - - hostName[length] = '\0'; - - // You can use the "isResolvingName()" function to find out whether the - // mDNS library is currently resolving a host name. - // If so, we skip this input, since we want our previous request to continue. - if (!mdns.isResolvingName()) - { - if (length > 0) - { - MDNS_LOGDEBUG3("Receiving len = ", length, ", hostname", hostName); - - Serial.print("Resolving '"); - Serial.print(hostName); - Serial.println("' via Multicast DNS (Bonjour)..."); - - // Now we tell the mDNS library to resolve the host name. We give it a - // timeout of 5 seconds (e.g. 5000 milliseconds) to find an answer. The - // library will automatically resend the query every second until it - // either receives an answer or your timeout is reached - In either case, - // the callback function you specified in setup() will be called. - - mdns.resolveName(hostName, 5000); - } - } - - // This actually runs the mDNS module. YOU HAVE TO CALL THIS PERIODICALLY, - // OR NOTHING WILL WORK! Preferably, call it once per loop(). - mdns.run(); - - //delay(1000); -} +https://github.com/khoih-prog/MDNS_Generic/blob/754935e58e4a11de9fff4910e469e43511ad53eb/examples/Ethernet/ResolvingHostNames/ResolvingHostNames.ino#L24-L373 -// This function is called when a name is resolved via mDNS/Bonjour. We set -// this up in the setup() function above. The name you give to this callback -// function does not matter at all, but it must take exactly these arguments -// (a const char*, which is the hostName you wanted resolved, and a const -// byte[4], which contains the IP address of the host on success, or NULL if -// the name resolution timed out). -void nameFound(const char* name, IPAddress ip) -{ - if ( (ip[0] != 0) && (ip[1] != 0) && (ip[2] != 0) && (ip[3] != 0) ) - { - Serial.print("The IP address for '"); - Serial.print(name); - Serial.print("' is "); - Serial.println(ip); - - for (int i = 0; i < 4; i++) - { - MDNS_LOGDEBUG3("IP[", i, "]=", ip[i]); - } - } - else if (ip[0] == 0) - { - Serial.print("Resolving '"); - Serial.print(name); - Serial.println("' error."); - } - else - { - Serial.print("Resolving '"); - Serial.print(name); - Serial.println("' timed out."); - } -} -``` #### 2. File [defines.h](examples/Ethernet/ResolvingHostNames/defines.h) -```cpp -#ifndef defines_h -#define defines_h - -#define MDNS_DEBUG_PORT Serial - -// Debug Level from 0 to 4 -#define _MDNS_LOGLEVEL_ 1 - -#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \ - || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \ - || defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \ - || defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \ - || defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) ) - #if defined(ETHERNET_USE_SAMD) - #undef ETHERNET_USE_SAMD - #endif - #define ETHERNET_USE_SAMD true - #endif - -#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \ - defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \ - defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) ) - #if defined(ETHERNET_USE_NRF528XX) - #undef ETHERNET_USE_NRF528XX - #endif - #define ETHERNET_USE_NRF528XX true -#endif - -#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) ) - #if defined(ETHERNET_USE_SAM_DUE) - #undef ETHERNET_USE_SAM_DUE - #endif - #define ETHERNET_USE_SAM_DUE true -#endif - -#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ - defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ - defined(STM32WB) || defined(STM32MP1) ) - #if defined(ETHERNET_USE_STM32) - #undef ETHERNET_USE_STM32 - #endif - #define ETHERNET_USE_STM32 true -#endif - -#if ( defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || defined(ARDUINO_GENERIC_RP2040) ) - #if defined(ETHERNET_USE_RP2040) - #undef ETHERNET_USE_RP2040 - #endif - #define ETHERNET_USE_RP2040 true -#endif - - -#if ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) ) - - #if defined(BOARD_NAME) - #undef BOARD_NAME - #endif - - #if defined(CORE_CM7) - #warning Using Portenta H7 M7 core - #define BOARD_NAME "PORTENTA_H7_M7" - #else - #warning Using Portenta H7 M4 core - #define BOARD_NAME "PORTENTA_H7_M4" - #endif - -#elif defined(ETHERNET_USE_SAMD) - // For SAMD - - #if ( defined(ARDUINO_SAMD_ZERO) && !defined(SEEED_XIAO_M0) ) - #define BOARD_TYPE "SAMD Zero" - #elif defined(ARDUINO_SAMD_MKR1000) - #define BOARD_TYPE "SAMD MKR1000" - #elif defined(ARDUINO_SAMD_MKRWIFI1010) - #define BOARD_TYPE "SAMD MKRWIFI1010" - #elif defined(ARDUINO_SAMD_NANO_33_IOT) - #define BOARD_TYPE "SAMD NANO_33_IOT" - #elif defined(ARDUINO_SAMD_MKRFox1200) - #define BOARD_TYPE "SAMD MKRFox1200" - #elif ( defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) ) - #define BOARD_TYPE "SAMD MKRWAN13X0" - #elif defined(ARDUINO_SAMD_MKRGSM1400) - #define BOARD_TYPE "SAMD MKRGSM1400" - #elif defined(ARDUINO_SAMD_MKRNB1500) - #define BOARD_TYPE "SAMD MKRNB1500" - #elif defined(ARDUINO_SAMD_MKRVIDOR4000) - #define BOARD_TYPE "SAMD MKRVIDOR4000" - #elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) - #define BOARD_TYPE "SAMD ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS" - #elif defined(ADAFRUIT_FEATHER_M0_EXPRESS) - #define BOARD_TYPE "SAMD21 ADAFRUIT_FEATHER_M0_EXPRESS" - #elif defined(ADAFRUIT_METRO_M0_EXPRESS) - #define BOARD_TYPE "SAMD21 ADAFRUIT_METRO_M0_EXPRESS" - #elif defined(ADAFRUIT_CIRCUITPLAYGROUND_M0) - #define BOARD_TYPE "SAMD21 ADAFRUIT_CIRCUITPLAYGROUND_M0" - #elif defined(ADAFRUIT_GEMMA_M0) - #define BOARD_TYPE "SAMD21 ADAFRUIT_GEMMA_M0" - #elif defined(ADAFRUIT_TRINKET_M0) - #define BOARD_TYPE "SAMD21 ADAFRUIT_TRINKET_M0" - #elif defined(ADAFRUIT_ITSYBITSY_M0) - #define BOARD_TYPE "SAMD21 ADAFRUIT_ITSYBITSY_M0" - #elif defined(ARDUINO_SAMD_HALLOWING_M0) - #define BOARD_TYPE "SAMD21 ARDUINO_SAMD_HALLOWING_M0" - #elif defined(ADAFRUIT_METRO_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_EXPRESS" - #elif defined(ADAFRUIT_GRAND_CENTRAL_M4) - #define BOARD_TYPE "SAMD51 ADAFRUIT_GRAND_CENTRAL_M4" - #elif defined(ADAFRUIT_FEATHER_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_FEATHER_M4_EXPRESS" - #elif defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS" - #elif defined(ADAFRUIT_TRELLIS_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_TRELLIS_M4_EXPRESS" - #elif defined(ADAFRUIT_PYPORTAL) - #define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL" - #elif defined(ADAFRUIT_PYPORTAL_M4_TITANO) - #define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL_M4_TITANO" - #elif defined(ADAFRUIT_PYBADGE_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_M4_EXPRESS" - #elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) - #define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE" - #elif defined(ADAFRUIT_PYGAMER_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_M4_EXPRESS" - #elif defined(ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS" - #elif defined(ADAFRUIT_PYBADGE_AIRLIFT_M4) - #define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_AIRLIFT_M4" - #elif defined(ADAFRUIT_MONSTER_M4SK_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_MONSTER_M4SK_EXPRESS" - #elif defined(ADAFRUIT_HALLOWING_M4_EXPRESS) - #define BOARD_TYPE "SAMD51 ADAFRUIT_HALLOWING_M4_EXPRESS" - #elif defined(SEEED_WIO_TERMINAL) - #define BOARD_TYPE "SAMD SEEED_WIO_TERMINAL" - #elif defined(SEEED_FEMTO_M0) - #define BOARD_TYPE "SAMD SEEED_FEMTO_M0" - #elif defined(SEEED_XIAO_M0) - #define BOARD_TYPE "SAMD SEEED_XIAO_M0" - #define USE_THIS_SS_PIN A1 - #warning define SEEED_XIAO_M0 USE_THIS_SS_PIN == A1 - #elif defined(Wio_Lite_MG126) - #define BOARD_TYPE "SAMD SEEED Wio_Lite_MG126" - #elif defined(WIO_GPS_BOARD) - #define BOARD_TYPE "SAMD SEEED WIO_GPS_BOARD" - #elif defined(SEEEDUINO_ZERO) - #define BOARD_TYPE "SAMD SEEEDUINO_ZERO" - #elif defined(SEEEDUINO_LORAWAN) - #define BOARD_TYPE "SAMD SEEEDUINO_LORAWAN" - #elif defined(SEEED_GROVE_UI_WIRELESS) - #define BOARD_TYPE "SAMD SEEED_GROVE_UI_WIRELESS" - #elif defined(__SAMD21E18A__) - #define BOARD_TYPE "SAMD21E18A" - #elif defined(__SAMD21G18A__) - #define BOARD_TYPE "SAMD21G18A" - #elif defined(__SAMD51G19A__) - #define BOARD_TYPE "SAMD51G19A" - #elif defined(__SAMD51J19A__) - #define BOARD_TYPE "SAMD51J19A" - #elif defined(__SAMD51J20A__) - #define BOARD_TYPE "SAMD51J20A" - #elif defined(__SAM3X8E__) - #define BOARD_TYPE "SAM3X8E" - #elif defined(__CPU_ARC__) - #define BOARD_TYPE "CPU_ARC" - #elif defined(__SAMD51__) - #define BOARD_TYPE "SAMD51" - #else - #define BOARD_TYPE "SAMD Unknown" - #endif - -#elif (ETHERNET_USE_SAM_DUE) - #define BOARD_TYPE "SAM DUE" - -#elif (ETHERNET_USE_NRF528XX) - - #if defined(NRF52840_FEATHER) - #define BOARD_TYPE "NRF52840_FEATHER" - #elif defined(NRF52832_FEATHER) - #define BOARD_TYPE "NRF52832_FEATHER" - #elif defined(NRF52840_FEATHER_SENSE) - #define BOARD_TYPE "NRF52840_FEATHER_SENSE" - #elif defined(NRF52840_ITSYBITSY) - #define BOARD_TYPE "NRF52840_ITSYBITSY" - #elif defined(NRF52840_CIRCUITPLAY) - #define BOARD_TYPE "NRF52840_CIRCUITPLAY" - #elif defined(NRF52840_CLUE) - #define BOARD_TYPE "NRF52840_CLUE" - #elif defined(NRF52840_METRO) - #define BOARD_TYPE "NRF52840_METRO" - #elif defined(NRF52840_PCA10056) - #define BOARD_TYPE "NRF52840_PCA10056" - #elif defined(NINA_B302_ublox) - #define BOARD_TYPE "NINA_B302_ublox" - #elif defined(NINA_B112_ublox) - #define BOARD_TYPE "NINA_B112_ublox" - #elif defined(PARTICLE_XENON) - #define BOARD_TYPE "PARTICLE_XENON" - #elif defined(ARDUINO_NRF52_ADAFRUIT) - #define BOARD_TYPE "ARDUINO_NRF52_ADAFRUIT" - #else - #define BOARD_TYPE "nRF52 Unknown" - #endif - -#elif ( defined(CORE_TEENSY) ) - #if defined(__IMXRT1062__) - // For Teensy 4.1/4.0 - #define BOARD_TYPE "TEENSY 4.1/4.0" - #elif defined(__MK66FX1M0__) - #define BOARD_TYPE "Teensy 3.6" - #elif defined(__MK64FX512__) - #define BOARD_TYPE "Teensy 3.5" - #elif defined(__MKL26Z64__) - #define BOARD_TYPE "Teensy LC" - #elif defined(__MK20DX256__) - #define BOARD_TYPE "Teensy 3.2" // and Teensy 3.1 (obsolete) - #elif defined(__MK20DX128__) - #define BOARD_TYPE "Teensy 3.0" - #elif defined(__AVR_AT90USB1286__) - #error Teensy 2.0++ not supported yet - #elif defined(__AVR_ATmega32U4__) - #error Teensy 2.0 not supported yet - #else - // For Other Boards - #define BOARD_TYPE "Unknown Teensy Board" - #endif - -#elif (ETHERNET_USE_STM32) - #if defined(STM32F0) - #define BOARD_TYPE "STM32F0" - #elif defined(STM32F1) - #define BOARD_TYPE "STM32F1" - #elif defined(STM32F2) - #define BOARD_TYPE "STM32F2" - #elif defined(STM32F3) - #define BOARD_TYPE "STM32F3" - #elif defined(STM32F4) - #define BOARD_TYPE "STM32F4" - #elif defined(STM32F7) - #define BOARD_TYPE "STM32F7" - #elif defined(STM32L0) - #define BOARD_TYPE "STM32L0" - #elif defined(STM32L1) - #define BOARD_TYPE "STM32L1" - #elif defined(STM32L4) - #define BOARD_TYPE "STM32L4" - #elif defined(STM32H7) - #define BOARD_TYPE "STM32H7" - #elif defined(STM32G0) - #define BOARD_TYPE "STM32G0" - #elif defined(STM32G4) - #define BOARD_TYPE "STM32G4" - #elif defined(STM32WB) - #define BOARD_TYPE "STM32WB" - #elif defined(STM32MP1) - #define BOARD_TYPE "STM32MP1" - #else - #define BOARD_TYPE "STM32 Unknown" - #endif - -#elif ETHERNET_USE_RP2040 - - // Default pin 5 (in Mbed) or 17 to SS/CS - #if defined(ARDUINO_ARCH_MBED) - // For RPI Pico using Arduino Mbed RP2040 core - // SCK: GPIO2, MOSI: GPIO3, MISO: GPIO4, SS/CS: GPIO5 - - #define USE_THIS_SS_PIN 5 - - #if defined(BOARD_NAME) - #undef BOARD_NAME - #endif - - #if defined(ARDUINO_NANO_RP2040_CONNECT) - #define BOARD_TYPE "MBED NANO_RP2040_CONNECT" - #elif defined(ARDUINO_RASPBERRY_PI_PICO) - #define BOARD_TYPE "MBED RASPBERRY_PI_PICO" - #elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) - #define BOARD_TYPE "MBED ADAFRUIT_FEATHER_RP2040" - #elif defined(ARDUINO_GENERIC_RP2040) - #define BOARD_TYPE "MBED GENERIC_RP2040" - #else - #define BOARD_TYPE "MBED Unknown RP2040" - #endif - - #else - // For RPI Pico using E. Philhower RP2040 core - // SCK: GPIO18, MOSI: GPIO19, MISO: GPIO16, SS/CS: GPIO17 - #define USE_THIS_SS_PIN 17 - - #endif - - #define SS_PIN_DEFAULT USE_THIS_SS_PIN - - // For RPI Pico - #warning Use RPI-Pico RP2040 architecture - -#else - // For Mega - #define BOARD_TYPE "AVR Mega" -#endif - -#if defined(ARDUINO_BOARD) - #define BOARD_NAME ARDUINO_BOARD -#elif !defined(BOARD_NAME) - #define BOARD_NAME BOARD_TYPE -#endif - -#include - -// UIPEthernet, Ethernet_Shield_W5200, EtherCard, EtherSia libraries are not supported - -// To override the default CS/SS pin. Don't use unless you know exactly which pin to use -// You can define here or customize for each board at same place with BOARD_TYPE -// Check @ defined(SEEED_XIAO_M0) -//#define USE_THIS_SS_PIN 22 //21 //5 //4 //2 //15 - -// Only one if the following to be true -#define USE_ETHERNET false //true -#define USE_ETHERNET2 false //true -#define USE_ETHERNET3 false //true -#define USE_ETHERNET_LARGE false -#define USE_ETHERNET_PORTENTA_H7 true - -#if USE_ETHERNET_PORTENTA_H7 - //#include "PortentaEthernet.h" - #include "Ethernet.h" - #include "EthernetUdp.h" - #warning Using Portenta_Ethernet lib for Portenta_H7. - #define SHIELD_TYPE "Ethernet using Portenta_Ethernet Library" - -#elif USE_ETHERNET - #include "Ethernet.h" - #include "EthernetUdp.h" - #warning Use Ethernet lib - #define SHIELD_TYPE "W5x00 using Ethernet Library" -#elif USE_ETHERNET_LARGE - #include "EthernetLarge.h" - #include "EthernetUdp.h" - #warning Use EthernetLarge lib - #define SHIELD_TYPE "W5x00 using EthernetLarge Library" -#elif USE_ETHERNET2 - #include "Ethernet2.h" - #include "EthernetUdp2.h" - #warning Use Ethernet2 lib - #define SHIELD_TYPE "W5x00 using Ethernet2 Library" -#elif USE_ETHERNET3 - #include "Ethernet3.h" - #include "EthernetUdp3.h" - #warning Use Ethernet3 lib - #define SHIELD_TYPE "W5x00 using Ethernet3 Library" -#else - #define USE_ETHERNET true - #include "Ethernet.h" - #warning Use Ethernet lib - #define SHIELD_TYPE "W5x00 using Ethernet Library" -#endif - -// Enter a MAC address and IP address for your controller below. -#define NUMBER_OF_MAC 20 - -byte mac[][NUMBER_OF_MAC] = -{ - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 }, - { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 }, -}; - -// Select the IP address according to your local network -IPAddress ip(192, 168, 2, 222); - -#endif //defines_h -``` +https://github.com/khoih-prog/MDNS_Generic/blob/754935e58e4a11de9fff4910e469e43511ad53eb/examples/Ethernet/ResolvingHostNames/defines.h#L23-L449 --- ---