Skip to content

compatibility for esp8266 core #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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);
/*int command =*/ 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