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 4:c010265ed202, committed 2014-04-26
- Comitter:
- Sissors
- Date:
- Sat Apr 26 20:04:49 2014 +0000
- Parent:
- 3:7238e9bb74d2
- Child:
- 5:acfd0329f648
- Commit message:
- IRQs added
Changed in this revision
--- a/SoftSerial.h Sat Apr 26 16:35:20 2014 +0000 +++ b/SoftSerial.h Sat Apr 26 20:04:49 2014 +0000 @@ -65,7 +65,9 @@ * @param fptr A pointer to a void function, or 0 to set as none * @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty) */ - void attach(void (*fptr)(void), IrqType type=RxIrq); + void attach(void (*fptr)(void), IrqType type=RxIrq) { + fpointer[type].attach(fptr); + } /** Attach a member function to call whenever a serial interrupt is generated * @@ -74,7 +76,9 @@ * @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty) */ template<typename T> - void attach(T* tptr, void (T::*mptr)(void), IrqType type=RxIrq); + void attach(T* tptr, void (T::*mptr)(void), IrqType type=RxIrq) { + fpointer[type].attach(tptr, mptr); + } /** Generate a break condition on the serial line */ @@ -89,6 +93,9 @@ int _bits, _stop_bits, _total_bits; Parity _parity; + FunctionPointer fpointer[2]; + + //rx void rx_gpio_irq_handler(void); void rx_handler(void); int read_buffer, rx_bit;
--- a/SoftSerial_rx.cpp Sat Apr 26 16:35:20 2014 +0000 +++ b/SoftSerial_rx.cpp Sat Apr 26 20:04:49 2014 +0000 @@ -72,6 +72,7 @@ if (!rx_error) { out_valid = true; out_buffer = read_buffer; + fpointer[RxIrq].call(); } read_buffer = 0; rxticker.detach();
--- a/SoftSerial_tx.cpp Sat Apr 26 16:35:20 2014 +0000 +++ b/SoftSerial_tx.cpp Sat Apr 26 20:04:49 2014 +0000 @@ -22,6 +22,7 @@ { if (tx_bit == _total_bits) { tx_bit = -1; + fpointer[TxIrq].call(); return; }