diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2009-06-01 08:32:11 +0000 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2009-06-01 08:32:11 +0000 |
commit | db605dd18b11ecfb5cd9f92c721c52cb70543384 (patch) | |
tree | 8a9029ffc560970ce1204ba86785ad44ef044906 /libraries/Ethernet/Ethernet.cpp |
First integration of the Arduino code in Processing 5503: PreProcessor and Compiler have been integrated with changes to the Sketch.
Compilation still has problems (Thread error on success, and can't handle non-pde files in a sketch).
Modified the Mac OS X make.sh to copy the hardware, avr tools, and example over.
Removing some of the antlr stuff.
Disabling the Commander (command-line execution) for now.
Added Library, LibraryManager, and Target.
Added support for prefixed preferences (e.g. for boards and programmers).
Diffstat (limited to 'libraries/Ethernet/Ethernet.cpp')
-rw-r--r-- | libraries/Ethernet/Ethernet.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libraries/Ethernet/Ethernet.cpp b/libraries/Ethernet/Ethernet.cpp new file mode 100644 index 0000000..cb74876 --- /dev/null +++ b/libraries/Ethernet/Ethernet.cpp @@ -0,0 +1,38 @@ +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; |