Firmware for the controller of the JRO Radar Controller.
Dependencies: CR2 EthernetInterface FreescaleIAP I2CLCD SerialDriver jro k64f_EthLink mbed-rtos mbed
Fork of JRO_DDSv2 by
test_eth.cpp@6:20e6ba387783, 2016-03-14 (annotated)
- Committer:
- joaquinbvw
- Date:
- Mon Mar 14 19:52:12 2016 +0000
- Revision:
- 6:20e6ba387783
- Parent:
- 3:f84802422619
First attempt for the JRO Radar Controller firmware.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
miguelcordero191 | 3:f84802422619 | 1 | #if 0 |
miguelcordero191 | 3:f84802422619 | 2 | |
miguelcordero191 | 3:f84802422619 | 3 | #include "mbed.h" |
miguelcordero191 | 3:f84802422619 | 4 | #include "rtos.h" |
miguelcordero191 | 3:f84802422619 | 5 | #include "EthernetInterface.h" |
miguelcordero191 | 3:f84802422619 | 6 | |
miguelcordero191 | 3:f84802422619 | 7 | RawSerial pc(USBTX, USBRX); |
miguelcordero191 | 3:f84802422619 | 8 | EthernetInterface eth; |
miguelcordero191 | 3:f84802422619 | 9 | |
miguelcordero191 | 3:f84802422619 | 10 | #define IP_INI "10.10.50.85"; // IP |
miguelcordero191 | 3:f84802422619 | 11 | #define MASK_INI "255.255.255.0"; // MASK |
miguelcordero191 | 3:f84802422619 | 12 | #define GATEWAY_INI "10.10.50.1"; // GATEWAY |
miguelcordero191 | 3:f84802422619 | 13 | const char* IP = IP_INI; // IP |
miguelcordero191 | 3:f84802422619 | 14 | const char* MASK = MASK_INI; // MASK |
miguelcordero191 | 3:f84802422619 | 15 | const char* GATEWAY = GATEWAY_INI; // GATEWAY |
miguelcordero191 | 3:f84802422619 | 16 | |
miguelcordero191 | 3:f84802422619 | 17 | int main(){ |
miguelcordero191 | 3:f84802422619 | 18 | pc.printf("Initializing network interface...\r\n"); |
miguelcordero191 | 3:f84802422619 | 19 | if (0 == eth.init(IP, MASK, GATEWAY)) { |
miguelcordero191 | 3:f84802422619 | 20 | // It should always take this path |
miguelcordero191 | 3:f84802422619 | 21 | do { |
miguelcordero191 | 3:f84802422619 | 22 | pc.printf("Connecting to network...\r\n"); |
miguelcordero191 | 3:f84802422619 | 23 | if (0 == eth.connect()) { |
miguelcordero191 | 3:f84802422619 | 24 | pc.printf("Ethernet connected as %s\r\n", eth.getIPAddress()); |
miguelcordero191 | 3:f84802422619 | 25 | Thread::wait(5000); |
miguelcordero191 | 3:f84802422619 | 26 | pc.printf("lost connection.\r\n"); |
miguelcordero191 | 3:f84802422619 | 27 | eth.disconnect(); |
miguelcordero191 | 3:f84802422619 | 28 | } |
miguelcordero191 | 3:f84802422619 | 29 | else { |
miguelcordero191 | 3:f84802422619 | 30 | pc.printf(" ... failed to connect.\r\n"); |
miguelcordero191 | 3:f84802422619 | 31 | } |
miguelcordero191 | 3:f84802422619 | 32 | } while (1); |
miguelcordero191 | 3:f84802422619 | 33 | } |
miguelcordero191 | 3:f84802422619 | 34 | else { |
miguelcordero191 | 3:f84802422619 | 35 | pc.printf(" ... failed to initialize, rebooting...\r\n"); |
miguelcordero191 | 3:f84802422619 | 36 | } |
miguelcordero191 | 3:f84802422619 | 37 | } |
miguelcordero191 | 3:f84802422619 | 38 | |
miguelcordero191 | 3:f84802422619 | 39 | #endif |