Skip to content

Commit d83c1ea

Browse files
committed
Make SPI_ETHERNET_SETTINGS and MAX_SOCK_NUM configurable at the project level
Closes arduino-libraries#267
1 parent 63eec86 commit d83c1ea

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/Ethernet.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
// up to 4 sockets. W5200 & W5500 can have up to 8 sockets. Several bytes
3434
// of RAM are used for each socket. Reducing the maximum can save RAM, but
3535
// you are limited to fewer simultaneous connections.
36-
#if defined(RAMEND) && defined(RAMSTART) && ((RAMEND - RAMSTART) <= 2048)
37-
#define MAX_SOCK_NUM 4
38-
#else
39-
#define MAX_SOCK_NUM 8
36+
#if !defined(MAX_SOCK_NUM)
37+
# if defined(RAMEND) && defined(RAMSTART) && ((RAMEND - RAMSTART) <= 2048)
38+
# define MAX_SOCK_NUM 4
39+
# else
40+
# define MAX_SOCK_NUM 8
41+
# endif
4042
#endif
4143

4244
// By default, each socket uses 2K buffers inside the WIZnet chip. If

src/utility/w5100.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include <SPI.h>
1919

2020
// Safe for all chips
21-
#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)
21+
#if !defined(SPI_ETHERNET_SETTINGS)
22+
# define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)
23+
#endif
2224

2325
// Safe for W5200 and W5500, but too fast for W5100
2426
// Uncomment this if you know you'll never need W5100 support.

0 commit comments

Comments
 (0)