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

Commit b75bc73

Browse files
authored
Update README.md and use allman astyle
1 parent 355c66d commit b75bc73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1385
-1326
lines changed

examples/AdvancedWebServer/AdvancedWebServer.ino

+23-22
Original file line numberDiff line numberDiff line change
@@ -164,47 +164,48 @@ void setup()
164164
digitalWrite(led, 0);
165165

166166
Serial.begin(115200);
167+
167168
while (!Serial && millis() < 5000);
168-
169+
169170
Serial.println("\nStart AdvancedWebServer on " + String(BOARD_NAME) + ", with " + String(SHIELD_TYPE));
170171

171172
#if USE_ETHERNET_GENERIC
172173
Serial.println(ETHERNET_GENERIC_VERSION);
173174
#endif
174-
175+
175176
Serial.println(ETHERNET_WEBSERVER_STM32_VERSION);
176177

177178
#if !(USE_BUILTIN_ETHERNET)
178-
#if (USING_SPI2)
179-
#if defined(CUR_PIN_MISO)
180-
ET_LOGWARN(F("Default SPI pinout:"));
181-
ET_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
182-
ET_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
183-
ET_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
184-
ET_LOGWARN1(F("SS:"), CUR_PIN_SS);
185-
ET_LOGWARN(F("========================="));
186-
#endif
187-
#else
188-
ET_LOGWARN(F("Default SPI pinout:"));
189-
ET_LOGWARN1(F("MOSI:"), MOSI);
190-
ET_LOGWARN1(F("MISO:"), MISO);
191-
ET_LOGWARN1(F("SCK:"), SCK);
192-
ET_LOGWARN1(F("SS:"), SS);
193-
ET_LOGWARN(F("========================="));
194-
#endif
179+
#if (USING_SPI2)
180+
#if defined(CUR_PIN_MISO)
181+
ET_LOGWARN(F("Default SPI pinout:"));
182+
ET_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
183+
ET_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
184+
ET_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
185+
ET_LOGWARN1(F("SS:"), CUR_PIN_SS);
186+
ET_LOGWARN(F("========================="));
187+
#endif
188+
#else
189+
ET_LOGWARN(F("Default SPI pinout:"));
190+
ET_LOGWARN1(F("MOSI:"), MOSI);
191+
ET_LOGWARN1(F("MISO:"), MISO);
192+
ET_LOGWARN1(F("SCK:"), SCK);
193+
ET_LOGWARN1(F("SS:"), SS);
194+
ET_LOGWARN(F("========================="));
195+
#endif
195196
#endif
196197

197198
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
198199
// For other boards, to change if necessary
199-
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
200+
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
200201
Ethernet.init (USE_THIS_SS_PIN);
201202

202-
#elif USE_CUSTOM_ETHERNET
203+
#elif USE_CUSTOM_ETHERNET
203204
// You have to add initialization for your Custom Ethernet here
204205
// This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
205206
//Ethernet.init(USE_THIS_SS_PIN);
206207

207-
#endif //( ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
208+
#endif //( ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
208209
#endif
209210

210211
// start the ethernet connection and the server:

examples/AdvancedWebServer/defines.h

+21-21
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
1717
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
1818
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5) )
19-
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
19+
#error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
2020
#endif
2121

2222
#define DEBUG_ETHERNET_WEBSERVER_PORT Serial
2323

2424
// Debug Level from 0 to 4
2525
#define _ETHERNET_WEBSERVER_LOGLEVEL_ 2
2626

27-
// If USE_BUILTIN_ETHERNET == false and USE_UIP_ETHERNET == false =>
27+
// If USE_BUILTIN_ETHERNET == false and USE_UIP_ETHERNET == false =>
2828
// either use W5x00 with EthernetXYZ library
2929
// or ENC28J60 with EthernetENC library
3030
//#define USE_BUILTIN_ETHERNET true
@@ -42,7 +42,7 @@
4242
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
4343
// Only one if the following to be true
4444
#define USE_ETHERNET_GENERIC true
45-
#define USE_ETHERNET_ESP8266 false
45+
#define USE_ETHERNET_ESP8266 false
4646
#define USE_ETHERNET_ENC false
4747
#define USE_CUSTOM_ETHERNET false
4848
#endif
@@ -60,13 +60,13 @@
6060
#elif (USE_UIP_ETHERNET)
6161
#warning Using ENC28J60 & UIPEthernet lib
6262
#define SHIELD_TYPE "ENC28J60 & UIPEthernet Library"
63-
#elif USE_ETHERNET_GENERIC
63+
#elif USE_ETHERNET_GENERIC
6464
#warning Using W5x00 & Ethernet_Generic lib
65-
//#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library"
65+
//#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library"
6666
#elif USE_ETHERNET_ESP8266
6767
#include "Ethernet_ESP8266.h"
68-
#warning Using W5x00 & Ethernet_ESP8266 lib
69-
#define SHIELD_TYPE "W5x00 & Ethernet_ESP8266 Library"
68+
#warning Using W5x00 & Ethernet_ESP8266 lib
69+
#define SHIELD_TYPE "W5x00 & Ethernet_ESP8266 Library"
7070
#elif USE_ETHERNET_ENC
7171
#include "EthernetENC.h"
7272
#warning Using ENC28J60 & EthernetENC lib
@@ -87,51 +87,51 @@
8787
#if USE_ETHERNET_GENERIC
8888

8989
#include <SPI.h>
90-
90+
9191
// Be sure to use true only if necessary for your board, or compile error
9292
#define USING_CUSTOM_SPI true
9393

9494
#if ( USING_CUSTOM_SPI )
9595
// Currently test OK for F767ZI and L552ZE_Q
9696
#define USING_SPI2 true
9797

98-
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library and custom SPI"
99-
98+
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library and custom SPI"
99+
100100
#if (USING_SPI2)
101101
// For L552ZE-Q, F767ZI, but you can change the pins for any other boards
102102
// SCK: 23, MOSI: 22, MISO: 25, SS/CS: 24 for SPI1
103103
#define CUR_PIN_MISO 25
104104
#define CUR_PIN_MOSI 22
105105
#define CUR_PIN_SCK 23
106106
#define CUR_PIN_SS 24
107-
107+
108108
#define SPI_NEW_INITIALIZED true
109-
109+
110110
// Don't create the instance with CUR_PIN_SS, or Ethernet not working
111111
// To change for other boards' SPI libraries
112112
SPIClass SPI_New(CUR_PIN_MOSI, CUR_PIN_MISO, CUR_PIN_SCK);
113-
113+
114114
//#warning Using USE_THIS_SS_PIN = CUR_PIN_SS = 24
115-
115+
116116
#if defined(USE_THIS_SS_PIN)
117117
#undef USE_THIS_SS_PIN
118-
#endif
118+
#endif
119119
#define USE_THIS_SS_PIN CUR_PIN_SS //24
120-
120+
121121
#endif
122122

123123
#else
124124

125-
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library"
126-
125+
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library"
126+
127127
#endif
128-
128+
129129
#include "Ethernet_Generic.h"
130130

131131
#define ETHERNET_LARGE_BUFFERS
132132

133133
#define _ETG_LOGLEVEL_ 1
134-
134+
135135
#endif
136136

137137
//////////////////////////////////////////////////////////////////////////
@@ -165,7 +165,7 @@
165165
#define BOARD_TYPE "STM32L4"
166166
#elif defined(STM32L5)
167167
#warning STM32L5 board selected
168-
#define BOARD_TYPE "STM32L5"
168+
#define BOARD_TYPE "STM32L5"
169169
#elif defined(STM32H7)
170170
#warning STM32H7 board selected
171171
#define BOARD_TYPE "STM32H7"

examples/HTTPClient/BasicAuthGet/BasicAuthGet.ino

+35-34
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ EthernetHttpClient httpClient(client, serverAddress, port);
3131
void setup()
3232
{
3333
Serial.begin(115200);
34+
3435
while (!Serial && millis() < 5000);
3536

3637
Serial.print("\nStarting BasicAuthGet on " + String(BOARD_NAME));
@@ -39,54 +40,54 @@ void setup()
3940
#if USE_ETHERNET_GENERIC
4041
Serial.println(ETHERNET_GENERIC_VERSION);
4142
#endif
42-
43+
4344
Serial.println(ETHERNET_WEBSERVER_STM32_VERSION);
4445

4546
#if !(USE_BUILTIN_ETHERNET)
46-
#if (USING_SPI2)
47-
#if defined(CUR_PIN_MISO)
48-
ET_LOGWARN(F("Default SPI pinout:"));
49-
ET_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
50-
ET_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
51-
ET_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
52-
ET_LOGWARN1(F("SS:"), CUR_PIN_SS);
53-
ET_LOGWARN(F("========================="));
54-
#endif
55-
#else
56-
ET_LOGWARN(F("Default SPI pinout:"));
57-
ET_LOGWARN1(F("MOSI:"), MOSI);
58-
ET_LOGWARN1(F("MISO:"), MISO);
59-
ET_LOGWARN1(F("SCK:"), SCK);
60-
ET_LOGWARN1(F("SS:"), SS);
61-
ET_LOGWARN(F("========================="));
62-
#endif
47+
#if (USING_SPI2)
48+
#if defined(CUR_PIN_MISO)
49+
ET_LOGWARN(F("Default SPI pinout:"));
50+
ET_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
51+
ET_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
52+
ET_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
53+
ET_LOGWARN1(F("SS:"), CUR_PIN_SS);
54+
ET_LOGWARN(F("========================="));
55+
#endif
56+
#else
57+
ET_LOGWARN(F("Default SPI pinout:"));
58+
ET_LOGWARN1(F("MOSI:"), MOSI);
59+
ET_LOGWARN1(F("MISO:"), MISO);
60+
ET_LOGWARN1(F("SCK:"), SCK);
61+
ET_LOGWARN1(F("SS:"), SS);
62+
ET_LOGWARN(F("========================="));
63+
#endif
64+
#endif
65+
66+
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
67+
// For other boards, to change if necessary
68+
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
69+
Ethernet.init (USE_THIS_SS_PIN);
70+
71+
#elif USE_CUSTOM_ETHERNET
72+
// You have to add initialization for your Custom Ethernet here
73+
// This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
74+
//Ethernet.init(USE_THIS_SS_PIN);
75+
76+
#endif //( ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
6377
#endif
6478

65-
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
66-
// For other boards, to change if necessary
67-
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
68-
Ethernet.init (USE_THIS_SS_PIN);
69-
70-
#elif USE_CUSTOM_ETHERNET
71-
// You have to add initialization for your Custom Ethernet here
72-
// This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
73-
//Ethernet.init(USE_THIS_SS_PIN);
74-
75-
#endif //( ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
76-
#endif
77-
7879
// start the ethernet connection and the server:
7980
// Use DHCP dynamic IP and random mac
8081
uint16_t index = millis() % NUMBER_OF_MAC;
8182
// Use Static IP
8283
//Ethernet.begin(mac[index], ip);
8384
Ethernet.begin(mac[index]);
84-
85+
8586
Serial.print(F("Connected! IP address: "));
8687
Serial.println(Ethernet.localIP());
8788
}
8889

89-
void loop()
90+
void loop()
9091
{
9192
Serial.println("making GET request with HTTP basic authentication");
9293
httpClient.beginRequest();
@@ -102,7 +103,7 @@ void loop()
102103
Serial.println(statusCode);
103104
Serial.print("Response: ");
104105
Serial.println(response);
105-
106+
106107
Serial.println("Wait five seconds");
107108
delay(5000);
108109
}

0 commit comments

Comments
 (0)