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 3:7238e9bb74d2, committed 2014-04-26
- Comitter:
- Sissors
- Date:
- Sat Apr 26 16:35:20 2014 +0000
- Parent:
- 2:9e01a38606b4
- Child:
- 4:c010265ed202
- Commit message:
- And RX to 19200 (todo: a fast mode which is not interrupt based)
Changed in this revision
SoftSerial.h | Show annotated file Show diff for this revision Revisions of this file |
SoftSerial_rx.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SoftSerial.h Sat Apr 26 16:21:42 2014 +0000 +++ b/SoftSerial.h Sat Apr 26 16:35:20 2014 +0000 @@ -96,6 +96,7 @@ volatile bool out_valid; bool rx_error; Timeout rxout; + Ticker rxticker; //tx void tx_handler(void);
--- a/SoftSerial_rx.cpp Sat Apr 26 16:21:42 2014 +0000 +++ b/SoftSerial_rx.cpp Sat Apr 26 16:35:20 2014 +0000 @@ -12,15 +12,17 @@ //Start receiving byte void SoftSerial::rx_gpio_irq_handler(void) { + rxout.attach_us(this, &SoftSerial::rx_handler, bit_period + (bit_period >> 1)); //Start reading first data byte rx->fall(NULL); rx_bit = 0; rx_error = false; - rxout.attach_us(this, &SoftSerial::rx_handler, bit_period + (bit_period >> 1)); //Start reading first data byte }; void SoftSerial::rx_handler(void) { + if (!rx_bit) + rxticker.attach_us(this, &SoftSerial::rx_handler, bit_period); + rx_bit++; - rxout.attach_us(this, &SoftSerial::rx_handler, bit_period); //Receive data int val = rx->read(); @@ -72,7 +74,7 @@ out_buffer = read_buffer; } read_buffer = 0; - rxout.detach(); + rxticker.detach(); rx->fall(this, &SoftSerial::rx_gpio_irq_handler); }