neingeist
/
arduinisten
Archived
1
0
Fork 0
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

39 lines
847 B
C++

extern "C" {
#include "types.h"
#include "w5100.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);
}
EthernetClass Ethernet;