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.
Dependencies: target-freescale
Diff: api/InterruptIn.h
- Revision:
- 13:d6551a5dcbbf
- Parent:
- 7:4fdb3a44f646
- Child:
- 16:086d28575041
diff -r b39597997d8a -r d6551a5dcbbf api/InterruptIn.h
--- a/api/InterruptIn.h Thu Mar 31 20:05:27 2016 -0500
+++ b/api/InterruptIn.h Thu Mar 31 20:10:32 2016 -0500
@@ -22,7 +22,7 @@
#include "gpio_api.h"
#include "gpio_irq_api.h"
-#include "Function.h"
+#include "FunctionPointer.h"
namespace mbed {
@@ -72,34 +72,32 @@
*
* @param fptr A pointer to a void function, or 0 to set as none
*/
- void rise(void (*fptr)(void));
+ void rise(FunctionPointer fptr);
/** Attach a member function to call when a rising edge occurs on the input
*
* @param tptr pointer to the object to call the member function on
* @param mptr pointer to the member function to be called
*/
- template<typename T>
- void rise(T* tptr, void (T::*mptr)(void)) {
- _rise.attach(tptr, mptr);
- gpio_irq_set(&gpio_irq, IRQ_RISE, 1);
+ template<typename T, typename M>
+ void rise(T *tptr, M *mptr) {
+ rise(FunctionPointer(tptr, mptr));
}
/** Attach a function to call when a falling edge occurs on the input
*
* @param fptr A pointer to a void function, or 0 to set as none
*/
- void fall(void (*fptr)(void));
+ void fall(FunctionPointer fptr);
/** Attach a member function to call when a falling edge occurs on the input
*
* @param tptr pointer to the object to call the member function on
* @param mptr pointer to the member function to be called
*/
- template<typename T>
- void fall(T* tptr, void (T::*mptr)(void)) {
- _fall.attach(tptr, mptr);
- gpio_irq_set(&gpio_irq, IRQ_FALL, 1);
+ template<typename T, typename M>
+ void fall(T *tptr, M *mptr) {
+ fall(FunctionPointer(tptr, mptr));
}
/** Set the input pin mode
@@ -124,8 +122,8 @@
gpio_t gpio;
gpio_irq_t gpio_irq;
- Function<void()> _rise;
- Function<void()> _fall;
+ FunctionPointer _rise;
+ FunctionPointer _fall;
};
} // namespace mbed