![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Serial buffer problem
main.cpp@0:56a10c93329f, 2010-10-11 (annotated)
- Committer:
- pd0wm
- Date:
- Mon Oct 11 18:46:18 2010 +0000
- Revision:
- 0:56a10c93329f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pd0wm | 0:56a10c93329f | 1 | #include "mbed.h" |
pd0wm | 0:56a10c93329f | 2 | #include "SerialBuffered.h" |
pd0wm | 0:56a10c93329f | 3 | |
pd0wm | 0:56a10c93329f | 4 | |
pd0wm | 0:56a10c93329f | 5 | Serial loggerSerial(USBTX, USBRX); |
pd0wm | 0:56a10c93329f | 6 | |
pd0wm | 0:56a10c93329f | 7 | |
pd0wm | 0:56a10c93329f | 8 | DigitalOut uart_activity(LED2); |
pd0wm | 0:56a10c93329f | 9 | |
pd0wm | 0:56a10c93329f | 10 | int main() { |
pd0wm | 0:56a10c93329f | 11 | SerialBuffered *b = new SerialBuffered( 1001, p28, p27); |
pd0wm | 0:56a10c93329f | 12 | b->baud( 9600 ); |
pd0wm | 0:56a10c93329f | 13 | b->setTimeout( 5 ); |
pd0wm | 0:56a10c93329f | 14 | while (1) { |
pd0wm | 0:56a10c93329f | 15 | if (b.readable()) { |
pd0wm | 0:56a10c93329f | 16 | loggerSerial.putc(b.getc()); |
pd0wm | 0:56a10c93329f | 17 | } |
pd0wm | 0:56a10c93329f | 18 | |
pd0wm | 0:56a10c93329f | 19 | } |
pd0wm | 0:56a10c93329f | 20 | |
pd0wm | 0:56a10c93329f | 21 | } |