Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
v1.2.0 to add support to Teensy 4.1 NativeEthernet
Browse files Browse the repository at this point in the history
### Release v1.2.0

1. Add support to [NativeEthernet Library](https://github.com/vjmuzik/NativeEthernet) for Teensy 4.1
2. Add Version String.
  • Loading branch information
khoih-prog authored Dec 4, 2020
1 parent f710efd commit 431ac1c
Show file tree
Hide file tree
Showing 74 changed files with 3,553 additions and 1,433 deletions.
188 changes: 139 additions & 49 deletions README.md

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions examples/AdvancedWebServer/AdvancedWebServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,17 @@ void setup(void)

Serial.print("\nStarting AdvancedWebServer on " + String(BOARD_NAME));
Serial.println(" with " + String(SHIELD_TYPE));
Serial.println("EthernetWebServer Version " + String(ETHERNET_WEBSERVER_VERSION));

#if USE_ETHERNET_WRAPPER

EthernetInit();

#else

#if USE_ETHERNET
#if USE_NATIVE_ETHERNET
ET_LOGWARN(F("======== USE_NATIVE_ETHERNET ========"));
#elif USE_ETHERNET
ET_LOGWARN(F("=========== USE_ETHERNET ==========="));
#elif USE_ETHERNET2
ET_LOGWARN(F("=========== USE_ETHERNET2 ==========="));
Expand All @@ -146,6 +149,8 @@ void setup(void)
ET_LOGWARN(F("=========== USE_ETHERNET_LARGE ==========="));
#elif USE_ETHERNET_ESP8266
ET_LOGWARN(F("=========== USE_ETHERNET_ESP8266 ==========="));
#elif USE_ETHERNET_ENC
ET_LOGWARN(F("=========== USE_ETHERNET_ENC ==========="));
#else
ET_LOGWARN(F("========================="));
#endif
Expand Down Expand Up @@ -242,10 +247,14 @@ void setup(void)
#define USE_THIS_SS_PIN 10 // For other boards
#endif

ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
#if defined(BOARD_NAME)
ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
#else
ET_LOGWARN1(F("Unknown board setCsPin:"), USE_THIS_SS_PIN);
#endif

// For other boards, to change if necessary
#if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 || USE_ETHERNET_ENC )
#if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET )
// Must use library patch for Ethernet, Ethernet2, EthernetLarge libraries

Ethernet.init (USE_THIS_SS_PIN);
Expand Down
39 changes: 26 additions & 13 deletions examples/AdvancedWebServer/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,15 @@

#if defined(__IMXRT1062__)
// For Teensy 4.1/4.0
#define BOARD_TYPE "TEENSY 4.1/4.0"
#if defined(ARDUINO_TEENSY41)
#define BOARD_TYPE "TEENSY 4.1"
// Use true for NativeEthernet Library, false if using other Ethernet libraries
#define USE_NATIVE_ETHERNET true
#elif defined(ARDUINO_TEENSY40)
#define BOARD_TYPE "TEENSY 4.0"
#else
#define BOARD_TYPE "TEENSY 4.x"
#endif
#elif defined(__MK66FX1M0__)
#define BOARD_TYPE "Teensy 3.6"
#elif defined(__MK64FX512__)
Expand Down Expand Up @@ -256,8 +264,6 @@
//#define USE_UIP_ETHERNET true
#define USE_UIP_ETHERNET false

//#define USE_CUSTOM_ETHERNET true

// Note: To rename ESP628266 Ethernet lib files to Ethernet_ESP8266.h and Ethernet_ESP8266.cpp
// In order to USE_ETHERNET_ESP8266
#if ( !defined(USE_UIP_ETHERNET) || !USE_UIP_ETHERNET )
Expand All @@ -268,24 +274,28 @@
//#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 true
#define USE_ETHERNET_ESP8266 false //true
#define USE_ETHERNET true
#define USE_ETHERNET2 false
#define USE_ETHERNET3 false
#define USE_ETHERNET_LARGE false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false

#if !USE_ETHERNET_WRAPPER

#if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE || USE_ETHERNET_ESP8266 || USE_ETHERNET_ENC )
#if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE || USE_ETHERNET_ESP8266 || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET )
#ifdef USE_CUSTOM_ETHERNET
#undef USE_CUSTOM_ETHERNET
#endif
#define USE_CUSTOM_ETHERNET false //true
#define USE_CUSTOM_ETHERNET false
#endif

#if USE_ETHERNET3

#if USE_NATIVE_ETHERNET
#include "NativeEthernet.h"
#warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
#define SHIELD_TYPE "Custom Ethernet using Teensy 4.1 NativeEthernet Library"
#elif USE_ETHERNET3
#include "Ethernet3.h"
#warning Using Ethernet3 lib
#define SHIELD_TYPE "W5x00 using Ethernet3 Library"
Expand All @@ -311,7 +321,10 @@
#warning Using Custom Ethernet library. You must include a library and initialize.
#define SHIELD_TYPE "Custom Ethernet using Ethernet_XYZ Library"
#else
#define USE_ETHERNET true
#ifdef USE_ETHERNET
#undef USE_ETHERNET
#endif
#define USE_ETHERNET true
#include "Ethernet.h"
#warning Using Ethernet lib
#define SHIELD_TYPE "W5x00 using Ethernet Library"
Expand Down
Loading

0 comments on commit 431ac1c

Please sign in to comment.