Fork of the original SoftSerial library with just a little modification in order to compile it with the current mbed version.
Dependents: Adafruit_FONA_Library_FONAtest
Fork of SoftSerial by
Revision 10:236fce2e5b8c, committed 2014-07-05
- Comitter:
- Sissors
- Date:
- Sat Jul 05 13:22:43 2014 +0000
- Parent:
- 9:4e4617c4a441
- Child:
- 11:7fdc1c46de79
- Commit message:
- Little bit faster initial read
Changed in this revision
SoftSerial_rx.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SoftSerial_rx.cpp Sat Jul 05 08:07:49 2014 +0000 +++ b/SoftSerial_rx.cpp Sat Jul 05 13:22:43 2014 +0000 @@ -1,5 +1,7 @@ #include "SoftSerial.h" +uint32_t overhead_us = 200 * 1000000 / SystemCoreClock; //Random estimation of the overhead of mbed libs, makes slow devices like LPC812 @ 12MHz perform better + int SoftSerial::_getc( void ) { while(!readable()); out_valid = false; @@ -13,18 +15,20 @@ //Start receiving byte void SoftSerial::rx_gpio_irq_handler(void) { rxticker.prime(); - rxticker.setNext(bit_period + (bit_period >> 1)); + rxticker.setNext(bit_period + (bit_period >> 1) - overhead_us); rx->fall(NULL); rx_bit = 0; rx_error = false; }; void SoftSerial::rx_handler(void) { + //Receive data + int val = rx->read(); + rxticker.setNext(bit_period); rx_bit++; - //Receive data - int val = rx->read(); + if (rx_bit <= _bits) { read_buffer |= val << (rx_bit - 1); return;