NuMaker Modbus-RS485

Dependencies:   Modbus nvt_rs485

Fork of modbus-over-rs485-sample by Wayne Lin

Files at this revision

API Documentation at this revision

Comitter:
SHLIU1@OANBE02333.nuvoton.com
Date:
Thu Feb 25 17:02:43 2021 +0800
Parent:
14:fe666edfe8a9
Child:
16:17aa5a8ada3f
Commit message:
Support the both V5.X and V6.X for mbed-os

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r fe666edfe8a9 -r a935936e74c1 main.cpp
--- a/main.cpp	Thu Feb 25 15:51:16 2021 +0800
+++ b/main.cpp	Thu Feb 25 17:02:43 2021 +0800
@@ -70,7 +70,9 @@
     eMBErrorCode    eStatus;
     //Thread uart_thread(worker_uart);
     unsigned short usSlaveID=GetValueOnDipSwitch();
-    
+#ifdef MBED_MAJOR_VERSION
+    printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
+#endif     
     // Initialise some registers
     for (int i=0; i<REG_INPUT_NREGS; i++)
          usRegInputBuf[i] = 0x0;
@@ -97,7 +99,11 @@
     for( ;; )
     {
         led2 = !led2;
+#if MBED_MAJOR_VERSION >= 6
+	ThisThread::sleep_for(200);
+#else
         Thread::wait(200);
+#endif
     }
 }