diff --git a/NanodeUIP.cpp b/NanodeUIP.cpp index cfa4fea..a3e9530 100644 --- a/NanodeUIP.cpp +++ b/NanodeUIP.cpp @@ -48,11 +48,15 @@ NanodeUIP::NanodeUIP(void) { } void NanodeUIP::init(const byte *macaddr) { + init(macaddr, NANODE_DEFAULT_CS); +} + +void NanodeUIP::init(const byte *macaddr, int cs) { const struct uip_eth_addr *mac=(struct uip_eth_addr *)macaddr; uip_setethaddr((*mac)); enc28j60SpiInit(); - enc28j60InitWithCs(macaddr, 8); + enc28j60InitWithCs(macaddr, cs); enc28j60clkout(2); // change clkout from 6.25MHz to 12.5MHz delay(10); timer_set(&periodic_timer, CLOCK_SECOND / 2); diff --git a/NanodeUIP.h b/NanodeUIP.h index 620a854..16801ae 100644 --- a/NanodeUIP.h +++ b/NanodeUIP.h @@ -7,6 +7,8 @@ #include // Arduino 0022 #endif +#define NANODE_DEFAULT_CS 8 + #include "uip.h" #include "timer.h" @@ -33,6 +35,7 @@ class NanodeUIP { NanodeUIP(void); void init(const byte *macaddr); // Call in setup() + void init(const byte *macaddr, int cs); void poll(void); // Must be called regularly in your sketch's loop() /* Link status functions */