Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion NanodeUIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions NanodeUIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <WProgram.h> // Arduino 0022
#endif

#define NANODE_DEFAULT_CS 8

#include "uip.h"
#include "timer.h"

Expand All @@ -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 */
Expand Down