Ethernet lib: slightly refactored SPI_ETHERNET_SETTING build

Prepare for next refactoring.
Doesn't change any behaviour.
This commit is contained in:
Cristian Maglie 2014-09-07 14:36:23 +02:00
parent 2274922d5e
commit 6d3e8c7f0f
1 changed files with 6 additions and 8 deletions

View File

@ -12,13 +12,7 @@
#include <SPI.h>
#define SPI_CS 10
#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
#define SPI_ETHERNET_SETTINGS SPISettings(4000000, MSBFIRST, SPI_MODE0)
#else
#define SPI_ETHERNET_SETTINGS SPI_CS,SPISettings(4000000, MSBFIRST, SPI_MODE0)
#endif
#define ETHERNET_SHIELD_SPI_CS 10
#define MAX_SOCK_NUM 4
@ -331,6 +325,7 @@ private:
private:
#if !defined(SPI_HAS_EXTENDED_CS_PIN_HANDLING)
#define SPI_ETHERNET_SETTINGS SPISettings(4000000, MSBFIRST, SPI_MODE0)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
inline static void initSS() { DDRB |= _BV(4); };
inline static void setSS() { PORTB &= ~_BV(4); };
@ -348,7 +343,10 @@ private:
inline static void setSS() { PORTB &= ~_BV(2); };
inline static void resetSS() { PORTB |= _BV(2); };
#endif
#endif // !SPI_HAS_EXTENDED_CS_PIN_HANDLING
#else
#define SPI_ETHERNET_SETTINGS ETHERNET_SHIELD_SPI_CS,SPISettings(4000000, MSBFIRST, SPI_MODE0)
// initSS(), setSS(), resetSS() not needed with EXTENDED_CS_PIN_HANDLING
#endif
};
extern W5100Class W5100;