Merge pull request #339 from tbowmo/samd
Fixes problem with MY_LED_BLINKING_FEATURE being enabled on all builds
This commit is contained in:
@@ -16,10 +16,10 @@ int EthernetClass::begin(uint8_t *mac_address, unsigned long timeout, unsigned l
|
||||
|
||||
// Initialise the basic info
|
||||
W5100.init();
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.setMACAddress(mac_address);
|
||||
W5100.setIPAddress(IPAddress(0,0,0,0).raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
|
||||
// Now try to get our config info from a DHCP server
|
||||
int ret = _dhcp->beginWithDHCP(mac_address, timeout, responseTimeout);
|
||||
@@ -27,11 +27,11 @@ int EthernetClass::begin(uint8_t *mac_address, unsigned long timeout, unsigned l
|
||||
{
|
||||
// We've successfully found a DHCP server and got our configuration info, so set things
|
||||
// accordingly
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
|
||||
W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
|
||||
W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
_dnsServerAddress = _dhcp->getDnsServerIp();
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dn
|
||||
void EthernetClass::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
|
||||
{
|
||||
W5100.init();
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.setMACAddress(mac);
|
||||
W5100.setIPAddress(local_ip.raw_address());
|
||||
W5100.setGatewayIp(gateway.raw_address());
|
||||
W5100.setSubnetMask(subnet.raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
_dnsServerAddress = dns_server;
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@ int EthernetClass::maintain(){
|
||||
case DHCP_CHECK_RENEW_OK:
|
||||
case DHCP_CHECK_REBIND_OK:
|
||||
//we might have got a new IP.
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
|
||||
W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
|
||||
W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
_dnsServerAddress = _dhcp->getDnsServerIp();
|
||||
break;
|
||||
default:
|
||||
@@ -104,27 +104,27 @@ int EthernetClass::maintain(){
|
||||
IPAddress EthernetClass::localIP()
|
||||
{
|
||||
IPAddress ret;
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.getIPAddress(ret.raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
return ret;
|
||||
}
|
||||
|
||||
IPAddress EthernetClass::subnetMask()
|
||||
{
|
||||
IPAddress ret;
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.getSubnetMask(ret.raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
return ret;
|
||||
}
|
||||
|
||||
IPAddress EthernetClass::gatewayIP()
|
||||
{
|
||||
IPAddress ret;
|
||||
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
SPI_ETH.beginTransaction(SPI_ETHERNET_SETTINGS);
|
||||
W5100.getGatewayIp(ret.raw_address());
|
||||
SPI.endTransaction();
|
||||
SPI_ETH.endTransaction();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,35 +152,12 @@
|
||||
|
||||
//#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
|
||||
|
||||
// default LEDs blinking period in milliseconds
|
||||
#ifndef MY_DEFAULT_LED_BLINK_PERIOD
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
#endif
|
||||
// The RX LED default pin
|
||||
#ifndef MY_DEFAULT_RX_LED_PIN
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#define MY_DEFAULT_RX_LED_PIN 8
|
||||
#else
|
||||
#define MY_DEFAULT_RX_LED_PIN 6
|
||||
#endif
|
||||
#endif
|
||||
// The TX LED default pin
|
||||
#ifndef MY_DEFAULT_TX_LED_PIN
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#define MY_DEFAULT_TX_LED_PIN 9
|
||||
#else
|
||||
#define MY_DEFAULT_TX_LED_PIN 5
|
||||
#endif
|
||||
#endif
|
||||
// The Error LED default pin
|
||||
#ifndef MY_DEFAULT_ERR_LED_PIN
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#define MY_DEFAULT_ERR_LED_PIN 7
|
||||
#else
|
||||
#define MY_DEFAULT_ERR_LED_PIN 4
|
||||
#endif
|
||||
#endif
|
||||
// The following defines can be used to set the port pin, that the LED is connected to
|
||||
// If one of the following is defined here, or in the sketch, MY_LEDS_BLINKING_FEATURE will be
|
||||
// enabled by default. (Replace x with the pin number you have the LED on)
|
||||
//#define MY_DEFAULT_ERR_LED x
|
||||
//#define MY_DEFAULT_TX_LED x
|
||||
//#define MY_DEFAULT_RX_LED x
|
||||
|
||||
/**********************************************
|
||||
* Gateway inclusion button/mode configuration
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "core/MyHwSAMD.cpp"
|
||||
#endif
|
||||
|
||||
// LEDS
|
||||
#if !defined(MY_DEFAULT_ERR_LED_PIN) & defined(MY_HW_ERR_LED_PIN)
|
||||
#define MY_DEFAULT_ERR_LED_PIN MY_HW_ERR_LED_PIN
|
||||
#endif
|
||||
@@ -67,7 +68,7 @@
|
||||
#endif
|
||||
|
||||
#if !defined(MY_DEFAULT_RX_LED_PIN) && defined(MY_HW_TX_LED_PIN)
|
||||
#define MY_DEFAULT_TX_LED_PIN MY_HW_TX_LED_PIN
|
||||
#define MY_DEFAULT_RX_LED_PIN MY_HW_TX_LED_PIN
|
||||
#endif
|
||||
|
||||
// Not necessary to include blinking feature if no LED's are defined!
|
||||
@@ -80,13 +81,43 @@
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
#endif
|
||||
|
||||
// LEDS
|
||||
|
||||
// default LEDs blinking period in milliseconds
|
||||
#ifndef MY_DEFAULT_LED_BLINK_PERIOD
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
#endif
|
||||
// The RX LED default pin
|
||||
#ifndef MY_DEFAULT_RX_LED_PIN
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#define MY_DEFAULT_RX_LED_PIN 8
|
||||
#else
|
||||
#define MY_DEFAULT_RX_LED_PIN 6
|
||||
#endif
|
||||
#endif
|
||||
// The TX LED default pin
|
||||
#ifndef MY_DEFAULT_TX_LED_PIN
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#define MY_DEFAULT_TX_LED_PIN 9
|
||||
#else
|
||||
#define MY_DEFAULT_TX_LED_PIN 5
|
||||
#endif
|
||||
#endif
|
||||
// The Error LED default pin
|
||||
#ifndef MY_DEFAULT_ERR_LED_PIN
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#define MY_DEFAULT_ERR_LED_PIN 7
|
||||
#else
|
||||
#define MY_DEFAULT_ERR_LED_PIN 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MY_LEDS_BLINKING_FEATURE)
|
||||
#include "core/MyLeds.cpp"
|
||||
#else
|
||||
#include "core/MyLeds.h"
|
||||
#endif
|
||||
|
||||
|
||||
// INCLUSION MODE
|
||||
#if defined(MY_INCLUSION_MODE_FEATURE)
|
||||
#include "core/MyInclusionMode.cpp"
|
||||
|
||||
Reference in New Issue
Block a user