diff --git a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino index 56ccc66c..99840354 100644 --- a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino +++ b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino @@ -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); diff --git a/src/Ethernet.cpp b/src/Ethernet.cpp index 658bd642..9257090c 100644 --- a/src/Ethernet.cpp +++ b/src/Ethernet.cpp @@ -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); diff --git a/src/utility/w5100.h b/src/utility/w5100.h index e6e01e1a..099556a6 100644 --- a/src/utility/w5100.h +++ b/src/utility/w5100.h @@ -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) @@ -463,4 +465,6 @@ extern W5100Class W5100; ((x)>>24 & 0x000000FFUL) ) #define ntohl(x) htonl(x) +#endif // !defined(htons) + #endif