fork frdm kl25z slave

Revision:
1:cfde7320b0bf
Parent:
0:274eb57e1df3
Child:
2:6ee56c002f64
--- a/portserial.cpp	Sun Aug 22 16:34:20 2010 +0000
+++ b/portserial.cpp	Tue Aug 09 08:21:33 2016 +0000
@@ -36,7 +36,8 @@
 static void prvvUARTISR( void );
 
 /* ----------------------- System Variables ---------------------------------*/
-Serial pc(USBTX, USBRX);            // Cam - mbed USB serial port
+//Serial pc(USBTX, USBRX);            // Cam - mbed USB serial port
+Serial pc(PG_2, PG_1);            // Cam - mbed USB serial port
 
 Ticker simISR;                      // Cam - mbed ticker
                                     // we don't have the TX buff empty interrupt, so
@@ -55,11 +56,15 @@
 {
     if (TxEnable)
         if(pc.writeable())
+        {
             prvvUARTTxReadyISR();
+        }
             
     if (RxEnable)
         if(pc.readable())
+        {
             prvvUARTRxISR();          
+        }           
 }
 
 void
@@ -72,14 +77,32 @@
     TxEnable = xTxEnable;
 }
 
+
+#if 1
+/* ----------------------- Start implementation -----------------------------*/
 BOOL
 xMBPortSerialInit( UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity )
 {
-    simISR.attach_us(&prvvUARTISR,1000);    // Cam - attach prvvUARTISR to a 1mS ticker to simulate serial interrupt behaviour
+    pc.baud(ulBaudRate);
+    return TRUE;
+}
+
+void xMBPortSerialPolling( void )
+{
+    prvvUARTISR( );
+}
+
+#else
+BOOL
+xMBPortSerialInit( UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity )
+{
+    pc.baud(ulBaudRate);
+    simISR.attach_us(&prvvUARTISR, 500);    // Cam - attach prvvUARTISR to a 1mS ticker to simulate serial interrupt behaviour
                                             // 1mS is just short of a character time at 9600 bps, so quick enough to pick
                                             // up status on a character by character basis.
     return TRUE;
 }
+#endif
 
 BOOL
 xMBPortSerialPutByte( CHAR ucByte )
@@ -97,7 +120,7 @@
     /* Return the byte in the UARTs receive buffer. This function is called
      * by the protocol stack after pxMBFrameCBByteReceived( ) has been called.
      */
-    * pucByte = pc.getc();
+    *pucByte = pc.getc();
     return TRUE;
 }