You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
845 B
C++
37 lines
845 B
C++
14 years ago
|
#include "w5100.h"
|
||
15 years ago
|
#include "Ethernet.h"
|
||
|
|
||
|
// XXX: don't make assumptions about the value of MAX_SOCK_NUM.
|
||
14 years ago
|
uint8_t EthernetClass::_state[MAX_SOCK_NUM] = {
|
||
|
0, 0, 0, 0 };
|
||
|
uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = {
|
||
|
0, 0, 0, 0 };
|
||
15 years ago
|
|
||
|
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)
|
||
|
{
|
||
14 years ago
|
uint8_t subnet[] = {
|
||
|
255, 255, 255, 0 };
|
||
15 years ago
|
begin(mac, ip, gateway, subnet);
|
||
|
}
|
||
|
|
||
|
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway, uint8_t *subnet)
|
||
|
{
|
||
14 years ago
|
W5100.init();
|
||
|
W5100.setMACAddress(mac);
|
||
|
W5100.setIPAddress(ip);
|
||
|
W5100.setGatewayIp(gateway);
|
||
|
W5100.setSubnetMask(subnet);
|
||
15 years ago
|
}
|
||
|
|
||
|
EthernetClass Ethernet;
|