Skip to content

Commit 6d3e8c7

Browse files
committed
Ethernet lib: slightly refactored SPI_ETHERNET_SETTING build
Prepare for next refactoring. Doesn't change any behaviour.
1 parent 2274922 commit 6d3e8c7

File tree

1 file changed

+6
-8
lines changed
  • libraries/Ethernet/src/utility

1 file changed

+6
-8
lines changed

libraries/Ethernet/src/utility/w5100.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@
1212

1313
#include <SPI.h>
1414

15-
#define SPI_CS 10
16-
17-
#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
18-
#define SPI_ETHERNET_SETTINGS SPISettings(4000000, MSBFIRST, SPI_MODE0)
19-
#else
20-
#define SPI_ETHERNET_SETTINGS SPI_CS,SPISettings(4000000, MSBFIRST, SPI_MODE0)
21-
#endif
15+
#define ETHERNET_SHIELD_SPI_CS 10
2216

2317
#define MAX_SOCK_NUM 4
2418

@@ -331,6 +325,7 @@ class W5100Class {
331325

332326
private:
333327
#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
328+
#define SPI_ETHERNET_SETTINGS SPISettings(4000000, MSBFIRST, SPI_MODE0)
334329
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
335330
inline static void initSS() { DDRB |= _BV(4); };
336331
inline static void setSS() { PORTB &= ~_BV(4); };
@@ -348,7 +343,10 @@ class W5100Class {
348343
inline static void setSS() { PORTB &= ~_BV(2); };
349344
inline static void resetSS() { PORTB |= _BV(2); };
350345
#endif
351-
#endif // !SPI_HAS_EXTENDED_CS_PIN_HANDLING
346+
#else
347+
#define SPI_ETHERNET_SETTINGS ETHERNET_SHIELD_SPI_CS,SPISettings(4000000, MSBFIRST, SPI_MODE0)
348+
// initSS(), setSS(), resetSS() not needed with EXTENDED_CS_PIN_HANDLING
349+
#endif
352350
};
353351

354352
extern W5100Class W5100;

0 commit comments

Comments
 (0)