D:/DRISSI/arduino-0022/arduino-0022/libraries/Ethernet/Ethernet.cpp
00001 #include "w5100.h"
00002 #include "Ethernet.h"
00003 
00004 // XXX: don't make assumptions about the value of MAX_SOCK_NUM.
00005 uint8_t EthernetClass::_state[MAX_SOCK_NUM] = { 
00006   0, 0, 0, 0 };
00007 uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = { 
00008   0, 0, 0, 0 };
00009 
00010 void EthernetClass::begin(uint8_t *mac, uint8_t *ip)
00011 {
00012   uint8_t gateway[4];
00013   gateway[0] = ip[0];
00014   gateway[1] = ip[1];
00015   gateway[2] = ip[2];
00016   gateway[3] = 1;
00017   begin(mac, ip, gateway);
00018 }
00019 
00020 void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway)
00021 {
00022   uint8_t subnet[] = { 
00023     255, 255, 255, 0   };
00024   begin(mac, ip, gateway, subnet);
00025 }
00026 
00027 void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway, uint8_t *subnet)
00028 {
00029   W5100.init();
00030   W5100.setMACAddress(mac);
00031   W5100.setIPAddress(ip);
00032   W5100.setGatewayIp(gateway);
00033   W5100.setSubnetMask(subnet);
00034 }
00035 
00036 EthernetClass Ethernet;