modified for nuc472

Dependents:   modbus-over-rs485-sample NTOUEE-mbed-modbus-RTU NuMaker_NuWicam_Lite

Fork of Modbus by Matthew Waddilove

Revision:
6:08849dd9654d
Parent:
5:d4c3b20819a7
Child:
7:be466464a18c
--- a/portserial.cpp	Tue Sep 20 06:28:05 2016 +0000
+++ b/portserial.cpp	Wed Jan 04 08:31:29 2017 +0000
@@ -39,12 +39,20 @@
 /* ----------------------- System Variables ---------------------------------*/
 
 #if defined(DEF_RS485_PORT) // mbed serial port
-#include "nvt_rs485.h"
-// RS485 TX, RX, RTS pins
-NvtRS485  pc(PF_13, PF_14, PF_11);
+    #include "nvt_rs485.h"
+    // RS485 TX, RX, RTS pins
+    #if defined(TARGET_NUMAKER_PFM_NUC472)      // for NUC472 board
+        NvtRS485  pc(PF_13, PF_14, PF_11);
+    #elif defined(TARGET_NUMAKER_PFM_M453)  // for M453 board
+        NvtRS485  pc(PE_8, PE_9, PE_11);
+    #endif
 #else
-//UART TX, RX
-Serial pc(PG_2, PG_1);
+    //UART TX, RX
+    #if defined(TARGET_NUMAKER_PFM_NUC472)  // for NUC472 board
+    Serial pc(PG_2, PG_1);
+    #elif defined(TARGET_NUMAKER_PFM_M453)  // for M453 board
+    Serial pc(PD_1, PD_6);    
+    #endif
 #endif
 
 static volatile BOOL RxEnable, TxEnable;     // Cam - keep a static copy of the RxEnable and TxEnable
@@ -84,7 +92,11 @@
 {
     pc.baud(ulBaudRate);
 #if defined(DEF_RS485_PORT) // mbed serial port
+    #if defined(TARGET_NUMAKER_PFM_NUC472)      // for NUC472 board
     pc.set_rs485_mode(PF_11);
+    #elif defined(TARGET_NUMAKER_PFM_M453)  // for M453 board
+    pc.set_rs485_mode(PE_11);
+    #endif    
 #endif
     return TRUE;
 }