UIPEthernet library for Arduino IDE, Eclipse with arduino plugin and MBED/SMeshStudio (AVR,STM32F,ESP8266,Intel ARC32,Nordic nRF51,Teensy boards,Realtek Ameba(RTL8195A,RTL8710)), ENC28j60 network chip. Compatible with Wiznet W5100 Ethernet library API. Compiled and tested on Nucleo-F302R8. Master repository is: https://github.com/UIPEthernet/UIPEthernet/

Files at this revision

API Documentation at this revision

Comitter:
cassyarduino
Date:
Tue Jan 23 15:08:43 2018 +0100
Parent:
38:645b253e6b50
Commit message:
Release: 2.0.4

Changed in this revision

UIPEthernet.cpp Show annotated file Show diff for this revision Revisions of this file
UIPEthernet.h Show annotated file Show diff for this revision Revisions of this file
UIPServer.cpp Show annotated file Show diff for this revision Revisions of this file
UIPUdp.cpp Show annotated file Show diff for this revision Revisions of this file
hardware/arduino_due_enc28j60_wiring.PNG Show annotated file Show diff for this revision Revisions of this file
keywords.txt Show annotated file Show diff for this revision Revisions of this file
utility/Enc28J60Network.cpp Show annotated file Show diff for this revision Revisions of this file
utility/Enc28J60Network.h Show annotated file Show diff for this revision Revisions of this file
utility/uip-conf.h Show annotated file Show diff for this revision Revisions of this file
utility/uipopt.h Show annotated file Show diff for this revision Revisions of this file
diff -r 645b253e6b50 -r deeb00b81cc9 UIPEthernet.cpp
--- a/UIPEthernet.cpp	Mon Mar 27 22:31:01 2017 +0200
+++ b/UIPEthernet.cpp	Tue Jan 23 15:08:43 2018 +0100
@@ -32,7 +32,7 @@
 
 extern "C"
 {
-#include "utility/uip-conf.h"
+#include "utility/uipopt.h"
 #include "utility/uip.h"
 #include "utility/uip_arp.h"
 #include "utility/uip_timer.h"
diff -r 645b253e6b50 -r deeb00b81cc9 UIPEthernet.h
--- a/UIPEthernet.h	Mon Mar 27 22:31:01 2017 +0200
+++ b/UIPEthernet.h	Tue Jan 23 15:08:43 2018 +0100
@@ -33,7 +33,7 @@
   #endif
 #endif
 #include "utility/Enc28J60Network.h"
-#include "utility/uip-conf.h"
+#include "utility/uipopt.h"
 #include "Dhcp.h"
 #if UIP_UDP
   #include "UIPUdp.h"
diff -r 645b253e6b50 -r deeb00b81cc9 UIPServer.cpp
--- a/UIPServer.cpp	Mon Mar 27 22:31:01 2017 +0200
+++ b/UIPServer.cpp	Tue Jan 23 15:08:43 2018 +0100
@@ -20,7 +20,7 @@
 #include "UIPServer.h"
 #include "utility/logging.h"
 extern "C" {
-  #include "utility/uip-conf.h"
+  #include "utility/uipopt.h"
 }
 
 UIPServer::UIPServer(uint16_t port) : _port(htons(port))
diff -r 645b253e6b50 -r deeb00b81cc9 UIPUdp.cpp
--- a/UIPUdp.cpp	Mon Mar 27 22:31:01 2017 +0200
+++ b/UIPUdp.cpp	Tue Jan 23 15:08:43 2018 +0100
@@ -23,7 +23,7 @@
 #include "utility/logging.h"
 
 extern "C" {
-#include "utility/uip-conf.h"
+#include "utility/uipopt.h"
 #include "utility/uip.h"
 #include "utility/uip_arp.h"
 }
diff -r 645b253e6b50 -r deeb00b81cc9 hardware/arduino_due_enc28j60_wiring.PNG
Binary file hardware/arduino_due_enc28j60_wiring.PNG has changed
diff -r 645b253e6b50 -r deeb00b81cc9 keywords.txt
--- a/keywords.txt	Mon Mar 27 22:31:01 2017 +0200
+++ b/keywords.txt	Tue Jan 23 15:08:43 2018 +0100
@@ -6,9 +6,9 @@
 # Datatypes (KEYWORD1)
 #######################################
 
-UIPEthernet KEYWORD1
-UIPServer KEYWORD1
-UIPClient KEYWORD1
+UIPEthernet	KEYWORD1
+UIPServer	KEYWORD1
+UIPClient	KEYWORD1
 
 #######################################
 # Methods and Functions (KEYWORD2)
diff -r 645b253e6b50 -r deeb00b81cc9 utility/Enc28J60Network.cpp
--- a/utility/Enc28J60Network.cpp	Mon Mar 27 22:31:01 2017 +0200
+++ b/utility/Enc28J60Network.cpp	Tue Jan 23 15:08:43 2018 +0100
@@ -35,7 +35,9 @@
 
 #if ENC28J60_USE_SPILIB
    #if defined(ARDUINO)
-     #if !defined(STM32F3) && !defined(__STM32F4__)
+     #if defined(STM32F2)
+       #include <SPI.h>
+     #elif !defined(STM32F3) && !defined(__STM32F4__)
        #include <SPI.h>
        extern SPIClass SPI;
      //#elif defined(ARDUINO_ARCH_AMEBA)
diff -r 645b253e6b50 -r deeb00b81cc9 utility/Enc28J60Network.h
--- a/utility/Enc28J60Network.h	Mon Mar 27 22:31:01 2017 +0200
+++ b/utility/Enc28J60Network.h	Tue Jan 23 15:08:43 2018 +0100
@@ -56,12 +56,12 @@
   #define ENC28J60_CONTROL_CS SPI_CS
 #endif
 
-#if defined(STM32F3)                //This is workaround for stm32duino STM32F3
+#if defined(STM32F3) || defined(STM32F2)                //This is workaround for stm32duino STM32F2, and adafruit wiced feather STM32F2
   #define BOARD_SPI1_NSS_PIN        PA4
   #define BOARD_SPI1_SCK_PIN        PA5
   #define BOARD_SPI1_MISO_PIN       PA6
   #define BOARD_SPI1_MOSI_PIN       PA7
-#endif                              //This is workaround for stm32duino STM32F3
+#endif                              			//This is workaround for stm32duino STM32F3, and adafruit wiced feather STM32F2
 
 #if defined(BOARD_discovery_f4)
   #define __STM32F4__
@@ -86,7 +86,9 @@
       #define ENC28J60_CONTROL_CS     SS
    #elif defined(__RFduino__) //RFduino
       #define ENC28J60_CONTROL_CS     SS
-   #elif defined(STM32_MCU_SERIES) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__)
+   #elif defined(ARDUINO_ARCH_STM32) // STM32duino core
+      #define ENC28J60_CONTROL_CS     SS
+   #elif defined(STM32_MCU_SERIES) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__) || defined(STM32F2)
       #if defined(BOARD_SPI1_NSS_PIN)
          #define ENC28J60_CONTROL_CS     BOARD_SPI1_NSS_PIN
       #elif defined(ARDUINO_STM32F4_NETDUINO2PLUS)
@@ -117,7 +119,9 @@
       #define SPI_MOSI MOSI
    #elif defined(__RFduino__) //RFduino
       #define SPI_MOSI MOSI
-   #elif defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__)
+   #elif defined(ARDUINO_ARCH_STM32) // STM32duino core
+      #define SPI_MOSI MOSI
+   #elif defined(STM32_MCU_SERIES) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__) || defined(STM32F2)
       #if defined(BOARD_SPI1_MOSI_PIN)
          #define SPI_MOSI BOARD_SPI1_MOSI_PIN
       #else
@@ -142,7 +146,9 @@
       #define SPI_MISO MISO
    #elif defined(__RFduino__) //RFduino
       #define SPI_MISO MISO
-   #elif defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__)
+   #elif defined(ARDUINO_ARCH_STM32) // STM32duino core
+      #define SPI_MISO MISO
+   #elif defined(STM32_MCU_SERIES) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__) || defined(STM32F2)
       #if defined(BOARD_SPI1_MISO_PIN)
          #define SPI_MISO BOARD_SPI1_MISO_PIN
       #else
@@ -166,7 +172,9 @@
       #define SPI_SCK SCK
    #elif defined(__RFduino__) //RFduino
       #define SPI_SCK SCK
-   #elif defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__)
+   #elif defined(ARDUINO_ARCH_STM32) // STM32duino core
+      #define SPI_SCK SCK
+   #elif defined(STM32_MCU_SERIES) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__) || defined(STM32F2)
       #if defined(BOARD_SPI1_SCK_PIN)
          #define SPI_SCK BOARD_SPI1_SCK_PIN
       #else
@@ -180,7 +188,7 @@
    #error "Not defined SPI_SCK!"
 #endif
 
-#if defined(__MBED__) || defined(ARDUINO_ARCH_SAM) || defined(__ARDUINO_ARC__) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__) || defined(ESP8266) || defined(ARDUINO_ARCH_AMEBA) || defined(__MK20DX128__) || defined(__MKL26Z64__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__RFduino__)
+#if defined(__MBED__) || defined(ARDUINO_ARCH_SAM) || defined(__ARDUINO_ARC__) || defined(__STM32F1__) || defined(__STM32F3__) || defined(STM32F3) || defined(__STM32F4__) || defined(STM32F2) || defined(ESP8266) || defined(ARDUINO_ARCH_AMEBA) || defined(__MK20DX128__) || defined(__MKL26Z64__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__RFduino__) || defined(ARDUINO_ARCH_STM32)
    #if defined(ARDUINO) && defined(STM32F3)
       #include "HardwareSPI.h"
    #else
diff -r 645b253e6b50 -r deeb00b81cc9 utility/uip-conf.h
--- a/utility/uip-conf.h	Mon Mar 27 22:31:01 2017 +0200
+++ b/utility/uip-conf.h	Tue Jan 23 15:08:43 2018 +0100
@@ -118,12 +118,12 @@
 #define UIP_CONF_RECEIVE_WINDOW 512
 
 /**
- * CPU byte order.
+ * You can force CPU byte order.
  *
  * \hideinitializer
  */
-#define UIP_CONF_BYTE_ORDER      LITTLE_ENDIAN
 
+//#define FORCE_UIP_CONF_BYTE_ORDER	LITTLE_ENDIAN
 /**
  * Logging on or off
  *
diff -r 645b253e6b50 -r deeb00b81cc9 utility/uipopt.h
--- a/utility/uipopt.h	Mon Mar 27 22:31:01 2017 +0200
+++ b/utility/uipopt.h	Tue Jan 23 15:08:43 2018 +0100
@@ -61,14 +61,45 @@
 #define __UIPOPT_H__
 
 #ifndef UIP_LITTLE_ENDIAN
-#define UIP_LITTLE_ENDIAN  3412
+  #if defined(LITTLE_ENDIAN)
+    #define UIP_LITTLE_ENDIAN LITTLE_ENDIAN
+  #elif defined(__ORDER_LITTLE_ENDIAN__)
+    #define UIP_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+  #else
+    #define UIP_LITTLE_ENDIAN 1234
+  #endif
 #endif /* UIP_LITTLE_ENDIAN */
 #ifndef UIP_BIG_ENDIAN
-#define UIP_BIG_ENDIAN     1234
+  #if defined(BIG_ENDIAN)
+    #define UIP_BIG_ENDIAN BIG_ENDIAN
+  #elif defined(__ORDER_BIG_ENDIAN__)
+    #define UIP_BIG_ENDIAN __ORDER_BIG_ENDIAN__
+  #else
+    #define UIP_BIG_ENDIAN 4321
+  #endif
 #endif /* UIP_BIG_ENDIAN */
+#ifndef UIP_PDP_ENDIAN
+  #if defined(PDP_ENDIAN)
+    #define UIP_PDP_ENDIAN PDP_ENDIAN
+  #elif defined(__ORDER_PDP_ENDIAN__)
+    #define UIP_PDP_ENDIAN __ORDER_PDP_ENDIAN__
+  #else
+    #define UIP_PDP_ENDIAN 3412
+  #endif
+#endif /* UIP_PDP_ENDIAN */
 
 #include "uip-conf.h"
 
+#if defined(FORCE_UIP_CONF_BYTE_ORDER)
+  #warning "You forced 'FORCE_UIP_CONF_BYTE_ORDER' in 'utility/uip-conf.h'."
+  #define UIP_CONF_BYTE_ORDER      FORCE_UIP_CONF_BYTE_ORDER
+#elif defined(__BYTE_ORDER__)
+  #warning "Endianness configured automaticaly."
+  #define UIP_CONF_BYTE_ORDER      __BYTE_ORDER__
+#else
+  #error "You must set FORCE_UIP_CONF_BYTE_ORDER in 'utility/uip-conf.h'."
+#endif
+
 /*------------------------------------------------------------------------------*/
 
 /**