Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit 20c7f86

Browse files
authored
v1.0.2
### New in Version v1.0.2 1. Remove dependendy on [`Functional-VLPP library`](https://github.com/khoih-prog/functional-vlpp). 2. Enhance examples and update README.md
1 parent c0af539 commit 20c7f86

19 files changed

+335
-58
lines changed

README.md

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/EthernetWebServer_STM32.svg?)](https://www.ardu-badge.com/EthernetWebServer_STM32)
44

5+
### New in Version v1.0.2
6+
7+
1. Remove dependendy on [`Functional-VLPP library`](https://github.com/khoih-prog/functional-vlpp).
8+
2. Enhance examples and update README.md
9+
510
### New in Version v1.0.1
611

712
1. Add support to ***W5x00*** Ethernet shields to all STM32 boards having 64+K bytes Flash.
813

914
This library currently supports
10-
1. STM32 boards with built-in Ethernet LAN8742A such as :
15+
1. STM32 boards with built-in Ethernet such as :
1116
- ***Nucleo-144 (F429ZI, F767ZI)***
1217
- ***Discovery (STM32F746G-DISCOVERY)***
1318
- ***All STM32 Boards with Built-in Ethernet***, See [How To Use Built-in Ethernet](https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1)
1419
2. ***STM32 boards (with 64+K Flash) running ENC28J60 shields***
1520
3. ***STM32 boards (with 64+K Flash) running W5x00 shields***
1621
4. See [EthernetWebServer Library Issue 1](https://github.com/khoih-prog/EthernetWebServer/issues/1) for reason to create this separate library from [EthernetWebServer library](https://github.com/khoih-prog/EthernetWebServer)
1722

18-
This is simple yet complete WebServer library for `STM32` boards running built-in Ethernet LAN8742A (Nucleo-144, Discovery) or EMC28J60 Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32.
23+
This is simple yet complete WebServer library for `STM32` boards running built-in Ethernet (Nucleo-144, Discovery) or EMC28J60 Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32.
1924

2025
The library supports
2126
1. HTTP Server and Client
@@ -32,13 +37,14 @@ The EthernetWebServer class found in `EthernetWebServer.h` header, is a simple w
3237
3. Depending on which Ethernet card you're using:
3338
- [STM32Ethernet library](https://github.com/stm32duino/STM32Ethernet) for built-in Ethernet on (Nucleo-144, Discovery)
3439
- [UIPEthernet library](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60
35-
4. [`Functional-VLPP library`](https://github.com/khoih-prog/functional-vlpp) to use lambda function
36-
5. [LwIP library](https://github.com/stm32duino/LwIP) for built-in Ethernet on (Nucleo-144, Discovery)
40+
- [Standard Ethernet library](https://www.arduino.cc/en/Reference/Ethernet) for W5x00
41+
4. [LwIP library](https://github.com/stm32duino/LwIP) for built-in Ethernet on (Nucleo-144, Discovery)
3742

3843
## Installation
3944

4045
### Use Arduino Library Manager
41-
Another way is to use `Arduino Library Manager` or [![arduino-library-badge](https://www.ardu-badge.com/badge/EthernetWebServer_STM32.svg?)](https://www.ardu-badge.com/EthernetWebServer_STM32). Search for `EthernetWebServer_STM32`, then select / install the latest version.
46+
The best way is to use `Arduino Library Manager`. Search for `EthernetWebServer_STM32`, then select / install the latest version.
47+
You can also use this link [![arduino-library-badge](https://www.ardu-badge.com/badge/EthernetWebServer_STM32.svg?)](https://www.ardu-badge.com/EthernetWebServer_STM32) for more detailed instructions.
4248

4349
### Manual Install
4450

@@ -216,11 +222,50 @@ Please take a look at examples, as well.
216222
* 1) STM32 boards with built-in Ethernet (to use USE_BUILTIN_ETHERNET = true) such as :
217223
* - Nucleo-144 (F429ZI, F767ZI)
218224
* - Discovery (STM32F746G-DISCOVERY)
225+
* - All STM32 Boards with Built-in Ethernet, See How To Use Built-in Ethernet at (https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1)
219226
* 2) STM32 boards (with 64+K Flash) running EMC28J60 shields (to use USE_BUILTIN_ETHERNET = false)
227+
* 3) STM32 boards (with 32+K Flash) running W5x00 Ethernet shields
220228
*
221229
*/
222230

223-
#define USE_BUILTIN_ETHERNET false //true
231+
#if defined(ESP8266) || defined(ESP32) || defined(AVR) || (ARDUINO_SAM_DUE)
232+
#error This code is designed to run on STM32 platform, not AVR, SAM DUE, SAMD, ESP8266 nor ESP32! Please check your Tools->Board setting.
233+
#endif
234+
235+
#define USE_BUILTIN_ETHERNET true
236+
// If don't use USE_BUILTIN_ETHERNET, and USE_UIP_ETHERNET => use W5x00 with Ethernet library
237+
#define USE_UIP_ETHERNET false
238+
239+
#if (USE_BUILTIN_ETHERNET)
240+
#define ETHERNET_NAME "Built-in LAN8742A Ethernet"
241+
#elif (USE_UIP_ETHERNET)
242+
#define ETHERNET_NAME "ENC28J60 Ethernet Shield"
243+
#else
244+
#define ETHERNET_NAME "W5x00 Ethernet Shield"
245+
#endif
246+
247+
#if defined(STM32F0)
248+
#warning STM32F0 board selected
249+
#define DEVICE_NAME "STM32F0"
250+
#elif defined(STM32F1)
251+
#warning STM32F1 board selected
252+
#define DEVICE_NAME "STM32F1"
253+
#elif defined(STM32F2)
254+
#warning STM32F2 board selected
255+
#define DEVICE_NAME "STM32F2"
256+
#elif defined(STM32F3)
257+
#warning STM32F3 board selected
258+
#define DEVICE_NAME "STM32F3"
259+
#elif defined(STM32F4)
260+
#warning STM32F4 board selected
261+
#define DEVICE_NAME "STM32F4"
262+
#elif defined(STM32F7)
263+
#warning STM32F7 board selected
264+
#define DEVICE_NAME "STM32F7"
265+
#else
266+
#warning STM32 unknown board selected
267+
#define DEVICE_NAME "STM32 Unknown"
268+
#endif
224269

225270
#include <EthernetWebServer_STM32.h>
226271

@@ -265,7 +310,7 @@ void setup(void)
265310
// Open serial communications and wait for port to open:
266311
Serial.begin(115200);
267312
delay(1000);
268-
Serial.println("\nStarting HelloServer on Nucleo-144");
313+
Serial.println("\nStart HelloServer on " + String(DEVICE_NAME) + " board, running " + String(ETHERNET_NAME));
269314

270315
// start the ethernet connection and the server:
271316
Ethernet.begin(mac, ip);
@@ -338,16 +383,22 @@ HTTP EthernetWebServer is @ IP : 192.168.2.100
338383
</g>
339384
</svg>
340385
```
386+
387+
### New in Version v1.0.2
388+
389+
1. Remove dependendy on [`Functional-VLPP library`](https://github.com/khoih-prog/functional-vlpp).
390+
2. Enhance examples and update README.md
391+
341392
### Version v1.0.1
342393
343394
1. Add support to W5x00 Ethernet shields to all STM32 boards having 64+K bytes Flash.
344395
345396
### Version v1.0.0
346397
347-
This is simple yet complete WebServer library for `STM32` boards running built-in Ethernet LAN8742A (Nucleo-144, Discovery) or EMC28J60 Ethernet shields. ***The functions are similar and compatible to ESP8266/ESP32 WebServer libraries*** to make life much easier to port sketches from ESP8266/ESP32.
398+
This is simple yet complete WebServer library for `STM32` boards running built-in Ethernet (Nucleo-144, Discovery) or EMC28J60 Ethernet shields. ***The functions are similar and compatible to ESP8266/ESP32 WebServer libraries*** to make life much easier to port sketches from ESP8266/ESP32.
348399
349400
This library currently supports
350-
1. STM32 boards with built-in Ethernet LAN8742A such as :
401+
1. STM32 boards with built-in Ethernet such as :
351402
- Nucleo-144 (F429ZI, F767ZI)
352403
- Discovery (STM32F746G-DISCOVERY)
353404
- All STM32 Boards with Built-in Ethernet, See [How To Use Built-in Ethernet](https://github.com/khoih-prog/EthernetWebServer_STM32/issues/1)
@@ -370,7 +421,7 @@ and these boards are not supported:
370421
- Nucleo-32 (small Flash/memory)
371422
- Eval (no Serial, just need to redefine in sketch, library and UIPEthernet)
372423
- Generic STM32F0 (small Flash/memory)
373-
- Generic STM32F1 (with <64K Flash): C6
424+
- Generic STM32F1 (with 64-K Flash): C6
374425
- Generic STM32F3 : no HardwareSPI.h
375426
- Electronics Speed Controllers (small Flash/memory)
376427

examples/AdvancedWebServer/AdvancedWebServer.ino

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Forked and modified from ESP8266 https://github.com/esp8266/Arduino/releases
99
* Built by Khoi Hoang https://github.com/khoih-prog/ESP8266_AT_WebServer
1010
* Licensed under MIT license
11-
* Version: 1.0.1
11+
* Version: 1.0.2
1212
*
1313
* Copyright (c) 2015, Majenko Technologies
1414
* All rights reserved.
@@ -46,6 +46,7 @@
4646
* ------- ----------- ---------- -----------
4747
* 1.0.0 K Hoang 26/02/2020 Initial coding for STM32 with built-in Ethernet (Nucleo-144, DISCOVERY, etc) and ENC28J60
4848
* 1.0.1 K Hoang 28/02/2020 Add W5x00 Ethernet shields using Ethernet library
49+
* 1.0.2 K Hoang 05/03/2020 Remove dependency on functional-vlpp
4950
*****************************************************************************************************************************/
5051
/*
5152
* Currently support
@@ -57,11 +58,45 @@
5758
* 3) STM32 boards (with 32+K Flash) running W5x00 Ethernet shields
5859
*
5960
*/
61+
#if defined(ESP8266) || defined(ESP32) || defined(AVR) || (ARDUINO_SAM_DUE)
62+
#error This code is designed to run on STM32 platform, not AVR, SAM DUE, SAMD, ESP8266 nor ESP32! Please check your Tools->Board setting.
63+
#endif
6064

61-
#define USE_BUILTIN_ETHERNET false //true
65+
#define USE_BUILTIN_ETHERNET true
6266
// If don't use USE_BUILTIN_ETHERNET, and USE_UIP_ETHERNET => use W5x00 with Ethernet library
6367
#define USE_UIP_ETHERNET false
6468

69+
#if (USE_BUILTIN_ETHERNET)
70+
#define ETHERNET_NAME "Built-in LAN8742A Ethernet"
71+
#elif (USE_UIP_ETHERNET)
72+
#define ETHERNET_NAME "ENC28J60 Ethernet Shield"
73+
#else
74+
#define ETHERNET_NAME "W5x00 Ethernet Shield"
75+
#endif
76+
77+
#if defined(STM32F0)
78+
#warning STM32F0 board selected
79+
#define DEVICE_NAME "STM32F0"
80+
#elif defined(STM32F1)
81+
#warning STM32F1 board selected
82+
#define DEVICE_NAME "STM32F1"
83+
#elif defined(STM32F2)
84+
#warning STM32F2 board selected
85+
#define DEVICE_NAME "STM32F2"
86+
#elif defined(STM32F3)
87+
#warning STM32F3 board selected
88+
#define DEVICE_NAME "STM32F3"
89+
#elif defined(STM32F4)
90+
#warning STM32F4 board selected
91+
#define DEVICE_NAME "STM32F4"
92+
#elif defined(STM32F7)
93+
#warning STM32F7 board selected
94+
#define DEVICE_NAME "STM32F7"
95+
#else
96+
#warning STM32 unknown board selected
97+
#define DEVICE_NAME "STM32 Unknown"
98+
#endif
99+
65100
#include <EthernetWebServer_STM32.h>
66101

67102
// Enter a MAC address and IP address for your controller below.
@@ -71,7 +106,7 @@ byte mac[] = {
71106
};
72107

73108
// Select the IP address according to your local network
74-
IPAddress ip(192, 168, 2, 200);
109+
IPAddress ip(192, 168, 2, 230);
75110

76111
EthernetWebServer server(80);
77112

@@ -157,10 +192,11 @@ void setup(void)
157192
digitalWrite(led, 0);
158193

159194
Serial.begin(115200);
160-
Serial.println("\nStarting AdvancedServer");
195+
Serial.println("\nStart AdvancedServer on " + String(DEVICE_NAME) + " board, running " + String(ETHERNET_NAME));
161196

162197
// start the ethernet connection and the server:
163-
Ethernet.begin(mac, ip);
198+
//Ethernet.begin(mac, ip);
199+
Ethernet.begin(mac);
164200

165201
server.on("/", handleRoot);
166202
server.on("/test.svg", drawGraph);

examples/HelloServer/HelloServer.ino

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Forked and modified from ESP8266 https://github.com/esp8266/Arduino/releases
99
* Built by Khoi Hoang https://github.com/khoih-prog/ESP8266_AT_WebServer
1010
* Licensed under MIT license
11-
* Version: 1.0.1
11+
* Version: 1.0.2
1212
*
1313
* Original author:
1414
* @file Esp8266WebServer.h
@@ -18,6 +18,7 @@
1818
* ------- ----------- ---------- -----------
1919
* 1.0.0 K Hoang 26/02/2020 Initial coding for STM32 with built-in Ethernet (Nucleo-144, DISCOVERY, etc) and ENC28J60
2020
* 1.0.1 K Hoang 28/02/2020 Add W5x00 Ethernet shields using Ethernet library
21+
* 1.0.2 K Hoang 05/03/2020 Remove dependency on functional-vlpp
2122
*****************************************************************************************************************************/
2223
/*
2324
* Currently support
@@ -30,10 +31,45 @@
3031
*
3132
*/
3233

33-
#define USE_BUILTIN_ETHERNET false //true
34+
#if defined(ESP8266) || defined(ESP32) || defined(AVR) || (ARDUINO_SAM_DUE)
35+
#error This code is designed to run on STM32 platform, not AVR, SAM DUE, SAMD, ESP8266 nor ESP32! Please check your Tools->Board setting.
36+
#endif
37+
38+
#define USE_BUILTIN_ETHERNET true
3439
// If don't use USE_BUILTIN_ETHERNET, and USE_UIP_ETHERNET => use W5x00 with Ethernet library
3540
#define USE_UIP_ETHERNET false
3641

42+
#if (USE_BUILTIN_ETHERNET)
43+
#define ETHERNET_NAME "Built-in LAN8742A Ethernet"
44+
#elif (USE_UIP_ETHERNET)
45+
#define ETHERNET_NAME "ENC28J60 Ethernet Shield"
46+
#else
47+
#define ETHERNET_NAME "W5x00 Ethernet Shield"
48+
#endif
49+
50+
#if defined(STM32F0)
51+
#warning STM32F0 board selected
52+
#define DEVICE_NAME "STM32F0"
53+
#elif defined(STM32F1)
54+
#warning STM32F1 board selected
55+
#define DEVICE_NAME "STM32F1"
56+
#elif defined(STM32F2)
57+
#warning STM32F2 board selected
58+
#define DEVICE_NAME "STM32F2"
59+
#elif defined(STM32F3)
60+
#warning STM32F3 board selected
61+
#define DEVICE_NAME "STM32F3"
62+
#elif defined(STM32F4)
63+
#warning STM32F4 board selected
64+
#define DEVICE_NAME "STM32F4"
65+
#elif defined(STM32F7)
66+
#warning STM32F7 board selected
67+
#define DEVICE_NAME "STM32F7"
68+
#else
69+
#warning STM32 unknown board selected
70+
#define DEVICE_NAME "STM32 Unknown"
71+
#endif
72+
3773
#include <EthernetWebServer_STM32.h>
3874

3975
// Enter a MAC address and IP address for your controller below.
@@ -77,7 +113,7 @@ void setup(void)
77113
// Open serial communications and wait for port to open:
78114
Serial.begin(115200);
79115
delay(1000);
80-
Serial.println("\nStarting HelloServer on Nucleo-144");
116+
Serial.println("\nStart HelloServer on " + String(DEVICE_NAME) + " board, running " + String(ETHERNET_NAME));
81117

82118
// start the ethernet connection and the server:
83119
Ethernet.begin(mac, ip);

examples/HelloServer2/HelloServer2.ino

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Forked and modified from ESP8266 https://github.com/esp8266/Arduino/releases
99
* Built by Khoi Hoang https://github.com/khoih-prog/ESP8266_AT_WebServer
1010
* Licensed under MIT license
11-
* Version: 1.0.1
11+
* Version: 1.0.2
1212
*
1313
* Original author:
1414
* @file Esp8266WebServer.h
@@ -18,6 +18,7 @@
1818
* ------- ----------- ---------- -----------
1919
* 1.0.0 K Hoang 26/02/2020 Initial coding for STM32 with built-in Ethernet (Nucleo-144, DISCOVERY, etc) and ENC28J60
2020
* 1.0.1 K Hoang 28/02/2020 Add W5x00 Ethernet shields using Ethernet library
21+
* 1.0.2 K Hoang 05/03/2020 Remove dependency on functional-vlpp
2122
*****************************************************************************************************************************/
2223
/*
2324
* Currently support
@@ -30,10 +31,46 @@
3031
*
3132
*/
3233

33-
#define USE_BUILTIN_ETHERNET false //true
34+
#if defined(ESP8266) || defined(ESP32) || defined(AVR) || (ARDUINO_SAM_DUE)
35+
#error This code is designed to run on STM32 platform, not AVR, SAM DUE, SAMD, ESP8266 nor ESP32! Please check your Tools->Board setting.
36+
#endif
37+
38+
#define USE_BUILTIN_ETHERNET true
3439
// If don't use USE_BUILTIN_ETHERNET, and USE_UIP_ETHERNET => use W5x00 with Ethernet library
3540
#define USE_UIP_ETHERNET false
3641

42+
#if (USE_BUILTIN_ETHERNET)
43+
#define ETHERNET_NAME "Built-in LAN8742A Ethernet"
44+
#elif (USE_UIP_ETHERNET)
45+
#define ETHERNET_NAME "ENC28J60 Ethernet Shield"
46+
#else
47+
#define ETHERNET_NAME "W5x00 Ethernet Shield"
48+
#endif
49+
50+
#if defined(STM32F0)
51+
#warning STM32F0 board selected
52+
#define DEVICE_NAME "STM32F0"
53+
#elif defined(STM32F1)
54+
#warning STM32F1 board selected
55+
#define DEVICE_NAME "STM32F1"
56+
#elif defined(STM32F2)
57+
#warning STM32F2 board selected
58+
#define DEVICE_NAME "STM32F2"
59+
#elif defined(STM32F3)
60+
#warning STM32F3 board selected
61+
#define DEVICE_NAME "STM32F3"
62+
#elif defined(STM32F4)
63+
#warning STM32F4 board selected
64+
#define DEVICE_NAME "STM32F4"
65+
#elif defined(STM32F7)
66+
#warning STM32F7 board selected
67+
#define DEVICE_NAME "STM32F7"
68+
#else
69+
#warning STM32 unknown board selected
70+
#define DEVICE_NAME "STM32 Unknown"
71+
#endif
72+
73+
3774
#include <EthernetWebServer_STM32.h>
3875

3976
// Enter a MAC address and IP address for your controller below.
@@ -74,7 +111,7 @@ void setup(void)
74111
Serial.begin(115200);
75112

76113
delay(1000);
77-
Serial.println("\nStarting HelloServer2");
114+
Serial.println("\nStart HelloServer2 on " + String(DEVICE_NAME) + " board, running " + String(ETHERNET_NAME));
78115

79116
// start the ethernet connection and the server:
80117
Ethernet.begin(mac, ip);

0 commit comments

Comments
 (0)