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: BufferedSoftSerial neurGAI_Seeed_BLUETOOTH LPC-SD-35 ESP-WROOM-02_test ... more
Diff: SoftSerial.h
- Revision:
- 4:c010265ed202
- Parent:
- 3:7238e9bb74d2
- Child:
- 5:acfd0329f648
--- 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;