Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Frequency_Counter_w_GPS_1PPS FreqCntr_GPS1PPS_F746F4xx_w_recipro
Fork of iSerial by
Revision 8:20759f992d48, committed 2012-09-03
- Comitter:
- ykuroda
- Date:
- Mon Sep 03 17:59:00 2012 +0000
- Parent:
- 7:5a25789c3b55
- Child:
- 9:45be5c5d5101
- Commit message:
- bugfix of rx interrupt
Changed in this revision
| iSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/iSerial.cpp Mon Sep 03 17:26:38 2012 +0000
+++ b/iSerial.cpp Mon Sep 03 17:59:00 2012 +0000
@@ -9,8 +9,8 @@
#include "RingBuffer.h"
#include "iSerial.h"
-
-DigitalOut led4(LED4);
+//DigitalOut led3(LED3);
+//DigitalOut led4(LED4);
void
@@ -83,22 +83,19 @@
void
iSerial::rx_handler(void)
{
-// disable_uart_irq();
- if(Serial::readable()){
+// led3 = 1;
+ while(Serial::readable())
rxbuf.save(Serial::getc());
- }
-// enable_uart_irq();
+// led3 = 0;
}
void
iSerial::tx_handler(void)
{
-led4 = 1;
-// disable_uart_irq();
+// led4 = 1;
while(Serial::writeable() && txbuf.check())
Serial::putc( txbuf.read() );
-// enable_uart_irq();
-led4 = 0;
+// led4 = 0;
}
iSerial::iSerial(PinName _tx, PinName _rx, const char *_name, int _txbufsize, int _rxbufsize)
@@ -139,9 +136,10 @@
{
unsigned short int c;
- while(!rxbuf.check()) // wait receiving a character
- enable_uart_irq();
+ while(!rxbuf.check()); // wait receiving a character
+ disable_uart_irq();
c = rxbuf.read();
+ enable_uart_irq();
return c;
}
