daily_automated
This commit is contained in:
50
trunk/Arduino/libraries/ENC28J60/Ethernet.cpp
Normal file
50
trunk/Arduino/libraries/ENC28J60/Ethernet.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
extern "C" {
|
||||
#include "socket.h"
|
||||
}
|
||||
|
||||
#include "Ethernet.h"
|
||||
|
||||
// XXX: don't make assumptions about the value of MAX_SOCK_NUM.
|
||||
uint8_t EthernetClass::_state[MAX_SOCK_NUM] = { 0, 0, 0, 0 };
|
||||
uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = { 0, 0, 0, 0 };
|
||||
|
||||
void EthernetClass::begin(uint8_t *mac, uint8_t *ip)
|
||||
{
|
||||
uint8_t gateway[4];
|
||||
gateway[0] = ip[0];
|
||||
gateway[1] = ip[1];
|
||||
gateway[2] = ip[2];
|
||||
gateway[3] = 1;
|
||||
begin(mac, ip, gateway);
|
||||
}
|
||||
|
||||
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway)
|
||||
{
|
||||
uint8_t subnet[] = { 255, 255, 255, 0 };
|
||||
begin(mac, ip, gateway, subnet);
|
||||
}
|
||||
|
||||
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway, uint8_t *subnet)
|
||||
{
|
||||
iinchip_init();
|
||||
sysinit(0x55, 0x55);
|
||||
setSHAR(mac);
|
||||
setSIPR(ip);
|
||||
setGAR(gateway);
|
||||
setSUBR(subnet);
|
||||
}
|
||||
|
||||
#ifdef ETHERSHIELD_DEBUG
|
||||
uint8_t *EthernetClass::returnDebug() {
|
||||
return socketDebug();
|
||||
}
|
||||
void EthernetClass::clearDebug() {
|
||||
socketClearDebug();
|
||||
}
|
||||
|
||||
char *debug2str(uint8_t debugCode) {
|
||||
return debugCode2String(debugCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
EthernetClass Ethernet;
|
||||
Reference in New Issue
Block a user