Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ unsigned int readRegister(byte registerName, int numBytes) {
// take the chip select low to select the device:
digitalWrite(chipSelectPin, LOW);
// send the device the register you want to read:
int command = SPI.transfer(registerName);
SPI.transfer(registerName);
// send a value of 0 to read the first byte returned:
inByte = SPI.transfer(0x00);

Expand Down
6 changes: 5 additions & 1 deletion src/Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress g
if (W5100.init() == 0) return;
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
W5100.setMACAddress(mac);
#if ARDUINO > 106 || TEENSYDUINO > 121
#ifdef ESP8266
W5100.setIPAddress(&ip[0]);
W5100.setGatewayIp(&gateway[0]);
W5100.setSubnetMask(&subnet[0]);
#elif ARDUINO > 106 || TEENSYDUINO > 121
W5100.setIPAddress(ip._address.bytes);
W5100.setGatewayIp(gateway._address.bytes);
W5100.setSubnetMask(subnet._address.bytes);
Expand Down
4 changes: 4 additions & 0 deletions src/utility/w5100.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ extern W5100Class W5100;
#ifndef UTIL_H
#define UTIL_H

#ifndef htons

#define htons(x) ( (((x)<<8)&0xFF00) | (((x)>>8)&0xFF) )
#define ntohs(x) htons(x)

Expand All @@ -463,4 +465,6 @@ extern W5100Class W5100;
((x)>>24 & 0x000000FFUL) )
#define ntohl(x) htonl(x)

#endif // !defined(htons)

#endif