1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Adding SPI library and revising Ethernet library (Christian Maglie).

This commit is contained in:
David A. Mellis
2010-08-02 18:59:44 +00:00
parent 78e093b482
commit e24b135755
24 changed files with 1429 additions and 2524 deletions

View File

@ -1,13 +1,11 @@
extern "C" {
#include "types.h"
#include "w5100.h"
}
#include "Ethernet.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 };
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)
{
@ -21,18 +19,18 @@ void EthernetClass::begin(uint8_t *mac, uint8_t *ip)
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway)
{
uint8_t subnet[] = { 255, 255, 255, 0 };
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);
W5100.init();
W5100.setMACAddress(mac);
W5100.setIPAddress(ip);
W5100.setGatewayIp(gateway);
W5100.setSubnetMask(subnet);
}
EthernetClass Ethernet;