stm32h7 udp server with adc

Dependencies:   ADE7912

Revision:
0:837bd71aa81c
Child:
1:125ced0f8dd5
Child:
2:fcb521c36965
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 21 21:02:41 2020 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "LWIPStack.h"
+#include "ADE7912.h"
+
+EthernetInterface net;
+
+DigitalOut led1(LED1);
+Thread thread;
+
+void UDP_thread()
+{
+    printf("UDP Socket example\n");
+    net.set_network(SocketAddress("192.168.0.10"), SocketAddress("255.255.255.0"), SocketAddress("192.168.0.1"));
+    if (0 != net.connect()) {
+        printf("Error connecting\n");
+    }
+
+    UDPSocket sock;
+    sock.open(&net);
+    sock.bind(55151);
+    SocketAddress receive("192.168.0.1", 55151);
+
+    for(;;) {
+        char out_buffer[10] = "I am LED!";
+//        sock.recvfrom(&receive, &out_buffer, sizeof(out_buffer));
+//        printf(out_buffer);
+        if (0 > sock.sendto(receive, out_buffer, sizeof(out_buffer))) {
+            printf("Error sending data\n");
+        }
+        printf(out_buffer);
+        ThisThread::sleep_for(2000);
+    }
+}
+
+int main()
+{
+    struct ADE7912_Phase_Settings a_phase;
+    thread.start(UDP_thread);
+
+    while (true) {
+        led1 = !led1;
+        ThisThread::sleep_for(500);
+    }
+}