Improvement to the DebounceInt library providing an easier to use interface much more alike the usual InterrupIn interface
Fork of DebounceInt by
Diff: DebounceInt2.cpp
- Revision:
- 2:bd5a3171ebc4
- Parent:
- 1:3e9de727a215
- Child:
- 3:3b5c7faadd5c
--- a/DebounceInt2.cpp Tue Feb 25 05:07:21 2014 +0000 +++ b/DebounceInt2.cpp Tue Feb 25 06:37:35 2014 +0000 @@ -53,13 +53,13 @@ // Inputs: *fhandler(void), pointer to handler function which must be void *fhandler(void) // //**********************************************************************************************// - void DebounceInt2::attachRise(*fhandler){ //attach interrupt handler for interrupt on rising edge + void DebounceInt2::rise(t_fhandler fhandler){ //attach interrupt handler for interrupt on rising edge if(!(this->intRise)){//only allocate the pointer and Interrupt in once this->intRise= new InterruptIn(this->pin); } this->riseHandler=fhandler; - this->intRise->attach(this,&DebounceInt2::debouncePinRise); //This attaches our handler which + this->intRise->rise(this,&DebounceInt2::debouncePinRise); //This attaches our handler which //includes the debounce functionality } @@ -69,13 +69,13 @@ void DebounceInt2::enableRise(void){ //unmask rise interrupt handler for rising edge this->pinIntMask->unMaskIntR(); } - void DebounceInt2::attachFall(*fhandler){ //attach interrupt handler for interrupt on falling edge + void DebounceInt2::fall(t_fhandler fhandler){ //attach interrupt handler for interrupt on falling edge if(!(this->intFall)){//only allocate the pointer and Interrupt in once this->intFall= new InterruptIn(this->pin); } this->fallHandler=fhandler; - this->intFall->attach(this,&DebounceInt2::debouncePinFall); //This attaches our handler which + this->intFall->fall(this,&DebounceInt2::debouncePinFall); //This attaches our handler which //includes the debounce functionality }