Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RawEthernet mbed
Revision 0:f1193d5dfe26, committed 2018-08-20
- Comitter:
- hudakz
- Date:
- Mon Aug 20 11:47:11 2018 +0000
- Commit message:
- Initial release.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RawEthernet.lib Mon Aug 20 11:47:11 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/hudakz/code/RawEthernet/#ca476e0a1a28
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Aug 20 11:47:11 2018 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "RawEthernet.h" + +#define BUF_SIZE 100 + +uint8_t len; +uint8_t buf[BUF_SIZE]; + +// Ethernet settings +uint8_t myMac[6] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}; // MAC address of this slave device +uint8_t myIp[4] = {192, 168, 1, 191}; // Dummy IP used to tell LAN switches about the existence of this device +uint8_t remoteMac[6] = {0x52, 0x4f, 0x47, 0x49, 0x45, 0x52}; // MAC oddress of the master PC + +DigitalOut led1(LED1); +RawEthernet rawEthernet(PB_5, PB_4, PB_3, PB_6, myMac, myIp); // mosi, miso, sck, cs + +int main() +{ + rawEthernet.linkTo(remoteMac); + + while (true) { + len = rawEthernet.receive(buf, BUF_SIZE); + if (len != 0) { + // toggle LED to acknowledge reception of data + led1 = !led1; + + // do some stuff with data + + // in this test echo the received data to the sender + rawEthernet.send(buf, len); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Aug 20 11:47:11 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file