NuMaker Transfer data UART to Ethernet

Fork of Serial-to-Ethernet by Morgan Du

Files at this revision

API Documentation at this revision

Comitter:
cyliang
Date:
Mon Mar 06 04:07:18 2023 +0000
Parent:
6:014b1a469aed
Child:
8:098927aa3653
Commit message:
Update libs & merge code for Mbed OS 6; Remove BufferedSerial library for Mbed OS 6 compile.

Changed in this revision

NuMaker-mbed-SD-driver.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
ste_config.h Show annotated file Show diff for this revision Revisions of this file
uweb_server.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/NuMaker-mbed-SD-driver.lib	Tue Mar 02 10:09:10 2021 +0800
+++ b/NuMaker-mbed-SD-driver.lib	Mon Mar 06 04:07:18 2023 +0000
@@ -1,1 +1,1 @@
-https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#8027c2c886a6bb2d850d3121ec3e2e179450e41c
+https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#14c1976088b84b9dab92125325a26c4cf9de345b
--- a/main.cpp	Tue Mar 02 10:09:10 2021 +0800
+++ b/main.cpp	Mon Mar 06 04:07:18 2023 +0000
@@ -26,24 +26,24 @@
 
 #if defined (TARGET_NUMAKER_PFM_M487) || defined(TARGET_NUMAKER_IOT_M487)
 #if MBED_MAJOR_VERSION <= 5
-BufferSerial serial_0(PB_3, PB_2, 256, 4);    // UART1
-BufferSerial serial_1(PA_5, PA_4, 256, 4);    // UART5
-//BufferSerial serial_2(PB_13, PB_12, 256, 4);  // UART0, Debug
+BufferedSerial serial_0(PB_3, PB_2, 256, 4);    // UART1
+BufferedSerial serial_1(PA_5, PA_4, 256, 4);    // UART5
+//BufferedSerial serial_2(PB_13, PB_12, 256, 4);  // UART0, Debug
 #else
-BufferSerial serial_0(PB_3, PB_2);    // UART1
-BufferSerial serial_1(PA_5, PA_4);    // UART5
-//BufferSerial serial_2(PB_13, PB_12);  // UART0, Debug
+BufferedSerial serial_0(PB_3, PB_2);    // UART1
+BufferedSerial serial_1(PA_5, PA_4);    // UART5
+//BufferedSerial serial_2(PB_13, PB_12);  // UART0, Debug
 #endif
 
 #elif defined (TARGET_NUMAKER_PFM_NUC472)
 #if MBED_MAJOR_VERSION <= 5
-BufferSerial serial_0(PH_1, PH_0, 256, 4);    // UART4
-BufferSerial serial_1(PG_2, PG_1, 256, 4);    // UART0
-BufferSerial serial_2(PC_11, PC_10, 256, 4);  // UART2
+BufferedSerial serial_0(PH_1, PH_0, 256, 4);    // UART4
+BufferedSerial serial_1(PG_2, PG_1, 256, 4);    // UART0
+BufferedSerial serial_2(PC_11, PC_10, 256, 4);  // UART2
 #else
-BufferSerial serial_0(PH_1, PH_0);    // UART4
-BufferSerial serial_1(PG_2, PG_1);    // UART0
-BufferSerial serial_2(PC_11, PC_10);  // UART2
+BufferedSerial serial_0(PH_1, PH_0);    // UART4
+BufferedSerial serial_1(PG_2, PG_1);    // UART0
+BufferedSerial serial_2(PC_11, PC_10);  // UART2
 #endif
 
 #elif defined (TARGET_NUMAKER_PFM_M453) || defined(TARGET_NUMAKER_PFM_NANO130) || defined(TARGET_NUMAKER_PFM_M2351)
@@ -255,9 +255,7 @@
     SocketAddress ip_mask;
     SocketAddress ip_gwaddr;
     
-#ifdef MBED_MAJOR_VERSION
-    printf("Mbed OS version %d.%d.%d\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
-#endif
+    printf("\r\nmbed OS version is %d.\r\n", MBED_VERSION);
     printf("Start Serial-to-Ethernet...\r\n");
 
 #if ENABLE_WEB_CONFIG
@@ -316,8 +314,13 @@
     printf("Configure UART ports...\r\n");
     for(int i=0; i<MAX_UART_PORTS; i++)
     {
+#if MBED_MAJOR_VERSION <= 5
         port_config[i].pserial->baud(port_config[i].baud);
         port_config[i].pserial->format(port_config[i].data, port_config[i].parity, port_config[i].stop);
+#else
+        port_config[i].pserial->set_baud(port_config[i].baud);
+        port_config[i].pserial->set_format(port_config[i].data, port_config[i].parity, port_config[i].stop);
+#endif        
     }
     
     /* Configure network IP address */
@@ -365,3 +368,5 @@
     /* end of main task */    
     //eth.disconnect();
 }
+
+            
\ No newline at end of file
--- a/mbed-os.lib	Tue Mar 02 10:09:10 2021 +0800
+++ b/mbed-os.lib	Mon Mar 06 04:07:18 2023 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#b114a9c878519d6489ac3426697196bbea34c8ea
+https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
--- a/mbed_app.json	Tue Mar 02 10:09:10 2021 +0800
+++ b/mbed_app.json	Mon Mar 06 04:07:18 2023 +0000
@@ -9,6 +9,14 @@
         "SD_CD":   "NC"
     },
     "target_overrides": {
+        "*": {
+            "platform.stdio-baud-rate"          : 115200,
+            "platform.stdio-convert-newlines"   : true,
+            "lwip.socket-max"                   : 8,
+            "lwip.tcp-socket-max"               : 8, 
+            "lwip.tcp-server-max"               : 8, 
+            "lwip.udp-socket-max"               : 8       
+        },
         "NUMAKER_PFM_NUC472": {
             "SD_DAT0": "PF_5",
             "SD_DAT1": "PF_4",
--- a/ste_config.h	Tue Mar 02 10:09:10 2021 +0800
+++ b/ste_config.h	Mon Mar 06 04:07:18 2023 +0000
@@ -13,9 +13,9 @@
 #include "FATFileSystem.h"
 #include "NuSDBlockDevice.h"
 
-
-#include "BufferSerial.h"
-
+#if MBED_MAJOR_VERSION <= 5
+#include "BufferedSerial.h"
+#endif
 
 /* A simple web server for network and UART configuration
    0: Disable the web server.
@@ -70,7 +70,7 @@
 typedef struct {
     E_NetMode       mode;       // Network server or client mode
     int             port;       // Network port number (Server mode)
-    BufferSerial  *pserial;   // UART number
+    BufferedSerial  *pserial;   // UART number
     int             baud;       // UART baud
     int             data;       // UART data bits
     int             stop;       // UART stop bits
@@ -88,3 +88,5 @@
 void start_httpd(void);
 
 #endif
+
+            
\ No newline at end of file
--- a/uweb_server.cpp	Tue Mar 02 10:09:10 2021 +0800
+++ b/uweb_server.cpp	Mon Mar 06 04:07:18 2023 +0000
@@ -537,3 +537,5 @@
 }
 
 #endif
+
+            
\ No newline at end of file