2010-08-02 20:59:44 +02:00
|
|
|
#include "w5100.h"
|
2010-08-03 15:36:47 +02:00
|
|
|
#include "Ethernet.h"
|
2008-07-30 16:47:36 +02:00
|
|
|
|
|
|
|
// XXX: don't make assumptions about the value of MAX_SOCK_NUM.
|
2010-08-02 20:59:44 +02:00
|
|
|
uint8_t EthernetClass::_state[MAX_SOCK_NUM] = {
|
|
|
|
0, 0, 0, 0 };
|
|
|
|
uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = {
|
|
|
|
0, 0, 0, 0 };
|
2008-07-30 16:47:36 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2010-08-02 20:59:44 +02:00
|
|
|
uint8_t subnet[] = {
|
|
|
|
255, 255, 255, 0 };
|
2008-07-30 16:47:36 +02:00
|
|
|
begin(mac, ip, gateway, subnet);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway, uint8_t *subnet)
|
|
|
|
{
|
2010-08-02 20:59:44 +02:00
|
|
|
W5100.init();
|
|
|
|
W5100.setMACAddress(mac);
|
|
|
|
W5100.setIPAddress(ip);
|
|
|
|
W5100.setGatewayIp(gateway);
|
|
|
|
W5100.setSubnetMask(subnet);
|
2008-07-30 16:47:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
EthernetClass Ethernet;
|