Skip to content

Commit ed8cdcc

Browse files
committed
Ethernet lib: move AVR defines into a specific section
1 parent 6d3e8c7 commit ed8cdcc

File tree

1 file changed

+18
-16
lines changed
  • libraries/Ethernet/src/utility

1 file changed

+18
-16
lines changed

libraries/Ethernet/src/utility/w5100.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -326,22 +326,24 @@ class W5100Class {
326326
private:
327327
#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
328328
#define SPI_ETHERNET_SETTINGS SPISettings(4000000, MSBFIRST, SPI_MODE0)
329-
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
330-
inline static void initSS() { DDRB |= _BV(4); };
331-
inline static void setSS() { PORTB &= ~_BV(4); };
332-
inline static void resetSS() { PORTB |= _BV(4); };
333-
#elif defined(__AVR_ATmega32U4__)
334-
inline static void initSS() { DDRB |= _BV(6); };
335-
inline static void setSS() { PORTB &= ~_BV(6); };
336-
inline static void resetSS() { PORTB |= _BV(6); };
337-
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
338-
inline static void initSS() { DDRB |= _BV(0); };
339-
inline static void setSS() { PORTB &= ~_BV(0); };
340-
inline static void resetSS() { PORTB |= _BV(0); };
341-
#else
342-
inline static void initSS() { DDRB |= _BV(2); };
343-
inline static void setSS() { PORTB &= ~_BV(2); };
344-
inline static void resetSS() { PORTB |= _BV(2); };
329+
#if defined(ARDUINO_ARCH_AVR)
330+
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
331+
inline static void initSS() { DDRB |= _BV(4); };
332+
inline static void setSS() { PORTB &= ~_BV(4); };
333+
inline static void resetSS() { PORTB |= _BV(4); };
334+
#elif defined(__AVR_ATmega32U4__)
335+
inline static void initSS() { DDRB |= _BV(6); };
336+
inline static void setSS() { PORTB &= ~_BV(6); };
337+
inline static void resetSS() { PORTB |= _BV(6); };
338+
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
339+
inline static void initSS() { DDRB |= _BV(0); };
340+
inline static void setSS() { PORTB &= ~_BV(0); };
341+
inline static void resetSS() { PORTB |= _BV(0); };
342+
#else
343+
inline static void initSS() { DDRB |= _BV(2); };
344+
inline static void setSS() { PORTB &= ~_BV(2); };
345+
inline static void resetSS() { PORTB |= _BV(2); };
346+
#endif
345347
#endif
346348
#else
347349
#define SPI_ETHERNET_SETTINGS ETHERNET_SHIELD_SPI_CS,SPISettings(4000000, MSBFIRST, SPI_MODE0)

0 commit comments

Comments
 (0)