App to configure a DDS (AD9854) using a K64F. USB an Ethernet were used as interface.
Dependencies: jro mbed AD9854 mbed-rtos I2CLCD k64f_EthLink SerialDriver FreescaleIAP EthernetInterface
test_eth.cpp
00001 #if 0 00002 00003 #include "mbed.h" 00004 #include "rtos.h" 00005 #include "EthernetInterface.h" 00006 00007 RawSerial pc(USBTX, USBRX); 00008 EthernetInterface eth; 00009 00010 #define IP_INI "10.10.50.85"; // IP 00011 #define MASK_INI "255.255.255.0"; // MASK 00012 #define GATEWAY_INI "10.10.50.1"; // GATEWAY 00013 const char* IP = IP_INI; // IP 00014 const char* MASK = MASK_INI; // MASK 00015 const char* GATEWAY = GATEWAY_INI; // GATEWAY 00016 00017 int main(){ 00018 pc.printf("Initializing network interface...\r\n"); 00019 if (0 == eth.init(IP, MASK, GATEWAY)) { 00020 // It should always take this path 00021 do { 00022 pc.printf("Connecting to network...\r\n"); 00023 if (0 == eth.connect()) { 00024 pc.printf("Ethernet connected as %s\r\n", eth.getIPAddress()); 00025 Thread::wait(5000); 00026 pc.printf("lost connection.\r\n"); 00027 eth.disconnect(); 00028 } 00029 else { 00030 pc.printf(" ... failed to connect.\r\n"); 00031 } 00032 } while (1); 00033 } 00034 else { 00035 pc.printf(" ... failed to initialize, rebooting...\r\n"); 00036 } 00037 } 00038 00039 #endif
Generated on Fri Jul 22 2022 04:19:33 by 1.7.2