-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from fprwi6labs/add_src
STM32Ethernet source files
- Loading branch information
Showing
32 changed files
with
4,401 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
Alberto Panu https://github.com/bigjohnson | ||
Alasdair Allan https://github.com/aallan | ||
Alice Pintus https://github.com/00alis | ||
Adrian McEwen https://github.com/amcewen | ||
Arduino LLC http://arduino.cc/ | ||
Arnie97 https://github.com/Arnie97 | ||
Arturo Guadalupi https://github.com/agdl | ||
Bjoern Hartmann https://people.eecs.berkeley.edu/~bjoern/ | ||
chaveiro https://github.com/chaveiro | ||
Cristian Maglie https://github.com/cmaglie | ||
David A. Mellis https://github.com/damellis | ||
Dino Tinitigan https://github.com/bigdinotech | ||
Eddy https://github.com/eddyst | ||
Federico Vanzati https://github.com/Fede85 | ||
Federico Fissore https://github.com/ffissore | ||
Jack Christensen https://github.com/JChristensen | ||
Johann Richard https://github.com/johannrichard | ||
Jordan Terrell https://github.com/iSynaptic | ||
Justin Paulin https://github.com/interwho | ||
lathoub https://github.com/lathoub | ||
Martino Facchin https://github.com/facchinm | ||
Matthias Hertel https://github.com/mathertel | ||
Matthijs Kooijman https://github.com/matthijskooijman | ||
Matt Robinson https://github.com/ribbons | ||
MCQN Ltd. http://mcqn.com/ | ||
Michael Amie https://github.com/michaelamie | ||
Michael Margolis https://github.com/michaelmargolis | ||
Norbert Truchsess https://github.com/ntruchsess | ||
Paul Stoffregen https://github.com/PaulStoffregen | ||
per1234 https://github.com/per1234 | ||
Richard Sim | ||
Scott Fitzgerald https://github.com/shfitz | ||
STMicroelectronics https://github.com/stm32duino | ||
Thibaut Viard https://github.com/aethaniel | ||
Tom Igoe https://github.com/tigoe | ||
Wi6Labs http://www.wi6labs.com/ | ||
WizNet http://www.wiznet.co.kr | ||
Zach Eveland https://github.com/zeveland | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
== License == | ||
|
||
Copyright (c) 2010 Arduino LLC. All right reserved. | ||
|
||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
|
||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
# STM32Ethernet | ||
# STM32Ethernet | ||
|
||
## Ethernet Library for Arduino | ||
|
||
With an STM32 board with Ethernet compatibility, this library allows a STM32 | ||
board (NUCLEO, DISCOVERY, ...) to connect to the internet. | ||
|
||
For more information about this library please visit us at | ||
http://www.arduino.cc/en/Reference/Ethernet | ||
|
||
## Note | ||
|
||
The library is based on LwIP, a Lightweight TCP/IP stack. | ||
http://git.savannah.gnu.org/cgit/lwip.git | ||
The LwIP has been ported as Arduino library. The STM32Ethernet library depends | ||
on it. | ||
|
||
EthernetClass::maintain() in no more required to renew IP address from DHCP. | ||
It is done automatically by the LwIP stack in a background task. | ||
|
||
An Idle task is required by the LwIP stack to handle timer and data reception. | ||
This idle task is called inside the main loop in background by the function | ||
stm32_eth_scheduler(). Be careful to not lock the system inside the function | ||
loop() where LwIP could never be updated. Call EthernetUDP::parsePacket() or | ||
EthernetClient::available() performs an update of the LwIP stack. | ||
|
||
## Wiki | ||
|
||
You can find information at https://github.com/stm32duino/wiki/wiki/STM32Ethernet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
Advanced Chat Server | ||
A more advanced server that distributes any incoming messages | ||
to all connected clients but the client the message comes from. | ||
To use, telnet to your device's IP address and type. | ||
You can see the client's input in the serial monitor as well. | ||
Circuit: | ||
* STM32 board with Ethernet support | ||
created 18 Dec 2009 | ||
by David A. Mellis | ||
modified 9 Apr 2012 | ||
by Tom Igoe | ||
redesigned to make use of operator== 25 Nov 2013 | ||
by Norbert Truchsess | ||
modified 23 Jun 2017 | ||
by Wi6Labs | ||
*/ | ||
|
||
#include <LwIP.h> | ||
#include <STM32Ethernet.h> | ||
|
||
// Enter a MAC address and IP address for your controller below. | ||
// The IP address will be dependent on your local network. | ||
// gateway and subnet are optional: | ||
byte mac[] = { | ||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED | ||
}; | ||
IPAddress ip(192, 168, 1, 177); | ||
IPAddress myDns(192, 168, 1, 1); | ||
IPAddress gateway(192, 168, 1, 1); | ||
IPAddress subnet(255, 255, 0, 0); | ||
|
||
|
||
// telnet defaults to port 23 | ||
EthernetServer server(23); | ||
|
||
EthernetClient clients[4]; | ||
|
||
void setup() { | ||
// initialize the Ethernet device | ||
Ethernet.begin(mac, ip, myDns, gateway, subnet); | ||
// start listening for clients | ||
server.begin(); | ||
// Open serial communications and wait for port to open: | ||
Serial.begin(9600); | ||
while (!Serial) { | ||
; // wait for serial port to connect. Needed for native USB port only | ||
} | ||
|
||
|
||
Serial.print("Chat server address:"); | ||
Serial.println(Ethernet.localIP()); | ||
} | ||
|
||
void loop() { | ||
// wait for a new client: | ||
EthernetClient client = server.available(); | ||
|
||
// when the client sends the first byte, say hello: | ||
if (client) { | ||
|
||
boolean newClient = true; | ||
for (byte i = 0; i < 4; i++) { | ||
//check whether this client refers to the same socket as one of the existing instances: | ||
if (clients[i] == client) { | ||
newClient = false; | ||
break; | ||
} | ||
} | ||
|
||
if (newClient) { | ||
//check which of the existing clients can be overridden: | ||
for (byte i = 0; i < 4; i++) { | ||
if (!clients[i] && clients[i] != client) { | ||
clients[i] = client; | ||
// clear out the input buffer: | ||
client.flush(); | ||
Serial.println("We have a new client"); | ||
client.print("Hello, client number: "); | ||
client.print(i); | ||
client.println(); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (client.available() > 0) { | ||
// read the bytes incoming from the client: | ||
char thisChar = client.read(); | ||
// echo the bytes back to all other connected clients: | ||
for (byte i = 0; i < 4; i++) { | ||
if (clients[i] && (clients[i] != client)) { | ||
clients[i].write(thisChar); | ||
} | ||
} | ||
// echo the bytes to the server as well: | ||
Serial.write(thisChar); | ||
} | ||
} | ||
for (byte i = 0; i < 4; i++) { | ||
if (!(clients[i].connected())) { | ||
// client.stop() invalidates the internal socket-descriptor, so next use of == will allways return false; | ||
clients[i].stop(); | ||
} | ||
} | ||
} |
Oops, something went wrong.