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

Committer:
miguelcordero191
Date:
Thu Sep 05 17:16:31 2019 +0000
Revision:
7:28725fb9a337
Parent:
3:f84802422619
2019_puerto2001

Who changed what in which revision?

UserRevisionLine numberNew 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