Transfer data between UART ports and Ethernet.

Dependencies:   BufferedSerial

Transfer data between UART ports and Ethernet.

  • Support multiple UART ports.
  • Support fixed IP address and DHCP.
  • Support TCP server and TCP client modes.
  • Support a simple web server for UART and Ethernet configuration.
Revision:
7:cbb5a2a2a0d2
Parent:
2:35f2cc8b05fa
Child:
8:e9248126f512
--- a/ste_config.h	Fri Mar 22 09:59:52 2019 +0000
+++ b/ste_config.h	Wed Feb 26 07:55:51 2020 +0000
@@ -10,19 +10,19 @@
 
 #include "mbed.h"
 #include "EthernetInterface.h"
-#include "TCPSocket.h"
-#include "TCPServer.h"
 #include "BufferedSerial.h"
 #include "FATFileSystem.h"
 #include "NuSDBlockDevice.h"
 
-/* Define ENABLE_WEB_CONFIG to active a simple web server for
-   UART ports and Ethernet port configuration. */
-#define ENABLE_WEB_CONFIG
+/* A simple web server for network and UART configuration
+   0: Disable the web server.
+   1: Enable the web server
+*/
+#define ENABLE_WEB_CONFIG   1
 
 /* Maximum UART ports supported.
-   It should be 1, 2, or 3. Please also define
-   mapping table "port_config[]" in main.c  */
+   Must define enough tuples of mapping table "port_config[]" in main.c
+*/
 #define MAX_UART_PORTS      2
 
 /* Default UART baud */
@@ -30,14 +30,15 @@
 
 /* Network base port number to listen.
    The base port maps to the 1st UART port,
-   the (base port + 1) maps to the 2nd UART port, etc. */
+   the (base port + 1) maps to the 2nd UART port, etc.
+*/
 #define NET_PORT_BASE   10001
 
 /* Files in SD card to store settings via web configuration */
 #define SER_CONFIG_FILE "/fs/STE_SER.TXT"   // for serial ports
 #define NET_CONFIG_FILE "/fs/STE_NET.TXT"   // for network
 
-/* Maximum size of server address for web configuration */
+/* Maximum size of server domain name or address for web configuration */
 #define MAX_SERVER_ADDRESS_SIZE     63
 
 /* Maximum size of IP address for web configuration */
@@ -65,7 +66,7 @@
 
 typedef struct {
     E_NetMode       mode;       // Network server or client mode
-    int             port;       // Network port number
+    int             port;       // Network port number (Server mode)
     BufferedSerial  *pserial;   // UART number
     int             baud;       // UART baud
     int             data;       // UART data bits