Skip to content

Commit

Permalink
Make SPI_ETHERNET_SETTINGS and MAX_SOCK_NUM configurable at the proje…
Browse files Browse the repository at this point in the history
…ct level

Closes arduino-libraries#267
  • Loading branch information
joeyparrish committed Jun 15, 2024
1 parent 63eec86 commit d83c1ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/Ethernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
// up to 4 sockets. W5200 & W5500 can have up to 8 sockets. Several bytes
// of RAM are used for each socket. Reducing the maximum can save RAM, but
// you are limited to fewer simultaneous connections.
#if defined(RAMEND) && defined(RAMSTART) && ((RAMEND - RAMSTART) <= 2048)
#define MAX_SOCK_NUM 4
#else
#define MAX_SOCK_NUM 8
#if !defined(MAX_SOCK_NUM)
# if defined(RAMEND) && defined(RAMSTART) && ((RAMEND - RAMSTART) <= 2048)
# define MAX_SOCK_NUM 4
# else
# define MAX_SOCK_NUM 8
# endif
#endif

// By default, each socket uses 2K buffers inside the WIZnet chip. If
Expand Down
4 changes: 3 additions & 1 deletion src/utility/w5100.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include <SPI.h>

// Safe for all chips
#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)
#if !defined(SPI_ETHERNET_SETTINGS)
# define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)
#endif

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

0 comments on commit d83c1ea

Please sign in to comment.