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