mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-31 20:52:13 +01:00
Ethernet: fixed regression for SAM (Arduino Due)
Fix https://github.com/arduino/Arduino/issues/4072
This commit is contained in:
parent
5be4466fd7
commit
21141513e2
@ -30,10 +30,10 @@ void W5100Class::init(void)
|
||||
SPI.begin();
|
||||
initSS();
|
||||
#else
|
||||
SPI.begin(SPI_CS);
|
||||
SPI.begin(ETHERNET_SHIELD_SPI_CS);
|
||||
// Set clock to 4Mhz (W5100 should support up to about 14Mhz)
|
||||
SPI.setClockDivider(SPI_CS, 21);
|
||||
SPI.setDataMode(SPI_CS, SPI_MODE0);
|
||||
SPI.setClockDivider(ETHERNET_SHIELD_SPI_CS, 21);
|
||||
SPI.setDataMode(ETHERNET_SHIELD_SPI_CS, SPI_MODE0);
|
||||
#endif
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
writeMR(1<<RST);
|
||||
@ -144,10 +144,10 @@ uint8_t W5100Class::write(uint16_t _addr, uint8_t _data)
|
||||
SPI.transfer(_data);
|
||||
resetSS();
|
||||
#else
|
||||
SPI.transfer(SPI_CS, 0xF0, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _data);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0xF0, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _data);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@ -165,10 +165,10 @@ uint16_t W5100Class::write(uint16_t _addr, const uint8_t *_buf, uint16_t _len)
|
||||
SPI.transfer(_buf[i]);
|
||||
resetSS();
|
||||
#else
|
||||
SPI.transfer(SPI_CS, 0xF0, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _buf[i]);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0xF0, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _buf[i]);
|
||||
_addr++;
|
||||
#endif
|
||||
}
|
||||
@ -185,10 +185,10 @@ uint8_t W5100Class::read(uint16_t _addr)
|
||||
uint8_t _data = SPI.transfer(0);
|
||||
resetSS();
|
||||
#else
|
||||
SPI.transfer(SPI_CS, 0x0F, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
uint8_t _data = SPI.transfer(SPI_CS, 0);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0x0F, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
uint8_t _data = SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0);
|
||||
#endif
|
||||
return _data;
|
||||
}
|
||||
@ -206,10 +206,10 @@ uint16_t W5100Class::read(uint16_t _addr, uint8_t *_buf, uint16_t _len)
|
||||
_buf[i] = SPI.transfer(0);
|
||||
resetSS();
|
||||
#else
|
||||
SPI.transfer(SPI_CS, 0x0F, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
_buf[i] = SPI.transfer(SPI_CS, 0);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0x0F, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr >> 8, SPI_CONTINUE);
|
||||
SPI.transfer(ETHERNET_SHIELD_SPI_CS, _addr & 0xFF, SPI_CONTINUE);
|
||||
_buf[i] = SPI.transfer(ETHERNET_SHIELD_SPI_CS, 0);
|
||||
_addr++;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user