= EMAC = [[PageOutline]] Provide the code to use the Ethernet MAC Layer. In the current state it uses the lwip stack to build a full functional TCP/IP stack. == Library == Import Library: {{{ http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk }}} or import precompiled Library: {{{ http://mbed.org/projects/cookbook/svn/EMAC/lwip/precomp }}} Import Example program: {{{ http://mbed.org/projects/cookbook/svn/EMAC/lwip/examples/HTTPServer }}} * For details on how to use this in the compiler, see [//handbook/Importing Importing Projects and Libraries in to the Compiler] == Hardware == To use this Library you have to connect the Ethernet pins of your mbed board with a Network. I have used a MagJack SI-60002-F to provide a RJ45 Jack. {{{ | | | | --||--||--||--||----- Socket mbed / 8 | 6 | 4 | 2 | /| 1 RD+ / 7 5 3 1 / | 2 / / | 3 RD- / Bel Stewart / | 4 TD- / MagJack / | 5 / SI-60002-F / | 6 TD+ /___________________ / | | -------- | | | -- -- | | | --- | ---- | / || /--/-/-/-/-/-/-|| / ___ ________ || / 8 7 6 5 4 3 2|| / ________________ -/ \- ____ | ____ | || / / / / / / / / || / ,= ,++, /, , , , , ,\|, , ,| , , /, ,| , |, , ,_| || / / / / / / / / /|| / ============================================================ ||/ ' ' ' ' ' ' ' ' || / | | | | | | | | | | | | | | | | | | | | | ------------------- |/ | | | | | | | | | | | | | | | | | | | | --------------------- ^ ^ ^ ^ Ethernet Socket Front mbed Board TD+TD-RD+RD- }}} * [http://www.belfuse.com/Data/Datasheets/SI-10021.pdf Internal wiring] == HTTP Server == A very easy to use HTTP Server which will server files from the flashdrive. The default file is called "index.htm". Furthermore it can serve rpc requests when you request a page starting with /rpc. For example: "http://mbed-ip-or-hostname/rpc/led1/write+1" For the rpc path you can use rather {{{,}}} or {{{+}}} or {{{=}}} or in a modern browser space which will be converted to {{{%20}}}. By default the server uses DHCP to connect to the network and will print out it's IP address to stdout (by default USB serial). || [[Include(source:/EMAC/lwip/examples/HTTPServer/main.cpp)]] || || ''Source Code of HTTPServer.bin ([source:/EMAC/lwip/examples/HTTPServer_LPC1768.bin LPC1768] [source:/EMAC/lwip/examples/HTTPServer_LPC2368.bin LPC2368]). ''|| == API == [[Include(//projects/cookbook/api/EMAC/lwip/trunk/HTTPServer/HTTPServer)]] * Full api at http://mbed.org/projects/cookbook/api/EMAC/lwip/trunk/HTTPServer * Full source at http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk/ == Resources == === HTTP Client === * [wiki:HTTPClient HTTP Client] - The HTTPClient class. * [wiki:EMAC/HTTPClient Twitter] - A simple demo how to use the HTTPClient class with twitter * [wiki:timetric Timetric] - A simple demo how to use the HTTPClient class with timetric === lwIP internal examples === * [wiki:EMAC/purehttpd Pure lwip HTTP Server] - Using lwIP direct to building a http server * [wiki:EMAC/purehttpc Pure lwip HTTP Client] - Using lwIP direct to build a http client * [wiki:EMAC/simplehttpd Simple HTTP Server] Using - TCPCallback classes to build a http server to how how to use the classes * [wiki:EMAC/simplehttpc Simple HTTP Client] - Using TCPCallback classes to build a http client to how how to use the classes === External resources === * [http://www.sics.se/~adam/lwip/ lwIP] * [http://savannah.nongnu.org/projects/lwip/ lwIP Savannah Project Page (SVN)] * [http://lwip.wikia.com/ The "new" lwIP Project Wiki] ----- == Development Log ==