RealtimeCompLab2

Dependencies:   mbed

Fork of PPP-Blinky by Nicolas Nackel

Revision:
56:b5b2e1c09f42
Parent:
55:43faae812be3
Child:
57:8deab70fef2e
--- a/main.cpp	Sun Jan 29 21:45:33 2017 +0000
+++ b/main.cpp	Sun Jan 29 23:07:53 2017 +0000
@@ -31,7 +31,7 @@
 #define SERIAL_PORT_MONITOR_NO /* or SERIAL_PORT_MONITOR_YES */
 
 #ifndef SERIAL_PORT_MONITOR_NO
-Serial xx(PC_10, PC_11); // Not necessary to run - if you have a compile error here change line 31 to SERIAL_PORT_MONITOR_NO
+Serial xx(PC_10, PC_11); // Not needed to run, if you get compile error here change #define SERIAL_PORT_MONITOR_YES to #define SERIAL_PORT_MONITOR_NO
 #define debug(x...) xx.printf (x)
 #else
 #define debug(x...) {}
@@ -142,8 +142,8 @@
 int pc_getBuf() // get one character from the buffer
 {
     if ( rxbufNotEmpty() ) {
+        __disable_irq(); // critical section start
         int x = ppp.rx.buf[ ppp.rx.tail ];
-        __disable_irq(); // critical section start
         ppp.rx.tail=(ppp.rx.tail+1)&(BUFLEN-1);
         __enable_irq(); // critical section end
         return x;