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.
InterruptIn Class Reference
A digital interrupt input, used to call a function on a rising or falling edge. More...
#include <InterruptIn.h>
Public Member Functions | |
| InterruptIn (PinName pin) | |
| Create an InterruptIn connected to the specified pin. | |
| pFunctionPointer_t | rise (void(*fptr)(void)) |
| Attach a function to call when a rising edge occurs on the input. | |
| pFunctionPointer_t | rise_add (void(*fptr)(void)) |
| Add a function to be called when a rising edge occurs at the end of the call chain. | |
| pFunctionPointer_t | rise_add_front (void(*fptr)(void)) |
| Add a function to be called when a rising edge occurs at the beginning of the call chain. | |
| template<typename T > | |
| pFunctionPointer_t | rise (T *tptr, void(T::*mptr)(void)) |
| Attach a member function to call when a rising edge occurs on the input. | |
| template<typename T > | |
| pFunctionPointer_t | rise_add (T *tptr, void(T::*mptr)(void)) |
| Add a function to be called when a rising edge occurs at the end of the call chain. | |
| template<typename T > | |
| pFunctionPointer_t | rise_add_front (T *tptr, void(T::*mptr)(void)) |
| Add a function to be called when a rising edge occurs at the beginning of the call chain. | |
| bool | rise_remove (pFunctionPointer_t pf) |
| Remove a function from the list of functions to be called when a rising edge occurs. | |
| pFunctionPointer_t | fall (void(*fptr)(void)) |
| Attach a function to call when a falling edge occurs on the input. | |
| pFunctionPointer_t | fall_add (void(*fptr)(void)) |
| Add a function to be called when a falling edge occurs at the end of the call chain. | |
| pFunctionPointer_t | fall_add_front (void(*fptr)(void)) |
| Add a function to be called when a falling edge occurs at the beginning of the call chain. | |
| template<typename T > | |
| pFunctionPointer_t | fall (T *tptr, void(T::*mptr)(void)) |
| Attach a member function to call when a falling edge occurs on the input. | |
| template<typename T > | |
| pFunctionPointer_t | fall_add (T *tptr, void(T::*mptr)(void)) |
| Add a function to be called when a falling edge occurs at the end of the call chain. | |
| template<typename T > | |
| pFunctionPointer_t | fall_add_front (T *tptr, void(T::*mptr)(void)) |
| Add a function to be called when a falling edge occurs at the beginning of the call chain. | |
| bool | fall_remove (pFunctionPointer_t pf) |
| Remove a function from the list of functions to be called when a falling edge occurs. | |
| void | mode (PinMode pull) |
| Set the input pin mode. | |
Detailed Description
A digital interrupt input, used to call a function on a rising or falling edge.
Example:
// Flash an LED while waiting for events #include "mbed.h" InterruptIn event(p16); DigitalOut led(LED1); void trigger() { printf("triggered!\n"); } int main() { event.rise(&trigger); while(1) { led = !led; wait(0.25); } }
Definition at line 55 of file InterruptIn.h.
Constructor & Destructor Documentation
| InterruptIn | ( | PinName | pin ) |
Create an InterruptIn connected to the specified pin.
- Parameters:
-
pin InterruptIn pin to connect to name (optional) A string to identify the object
Member Function Documentation
| pFunctionPointer_t fall | ( | void(*)(void) | fptr ) |
Attach a function to call when a falling edge occurs on the input.
- Parameters:
-
fptr A pointer to a void function, or 0 to set as none
- Returns:
- The function object created for 'fptr'
| pFunctionPointer_t fall | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) |
Attach a member function to call when a falling edge occurs on the input.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
- Returns:
- The function object created for 'tptr' and 'mptr'
Definition at line 195 of file InterruptIn.h.
| pFunctionPointer_t fall_add | ( | void(*)(void) | fptr ) |
Add a function to be called when a falling edge occurs at the end of the call chain.
- Parameters:
-
fptr the function to add
- Returns:
- The function object created for 'fptr'
Definition at line 171 of file InterruptIn.h.
| pFunctionPointer_t fall_add | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) |
Add a function to be called when a falling edge occurs at the end of the call chain.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
- Returns:
- The function object created for 'tptr' and 'mptr'
Definition at line 211 of file InterruptIn.h.
| pFunctionPointer_t fall_add_front | ( | void(*)(void) | fptr ) |
Add a function to be called when a falling edge occurs at the beginning of the call chain.
- Parameters:
-
fptr the function to add
- Returns:
- The function object created for 'fptr'
Definition at line 182 of file InterruptIn.h.
| pFunctionPointer_t fall_add_front | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) |
Add a function to be called when a falling edge occurs at the beginning of the call chain.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
- Returns:
- The function object created for 'tptr' and 'mptr'
Definition at line 224 of file InterruptIn.h.
| bool fall_remove | ( | pFunctionPointer_t | pf ) |
Remove a function from the list of functions to be called when a falling edge occurs.
- Parameters:
-
pf the function object to remove
- Returns:
- true if the function was found and removed, false otherwise
| void mode | ( | PinMode | pull ) |
Set the input pin mode.
- Parameters:
-
mode PullUp, PullDown, PullNone
| pFunctionPointer_t rise | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) |
Attach a member function to call when a rising edge occurs on the input.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
- Returns:
- The function object created for 'tptr' and 'mptr'
Definition at line 113 of file InterruptIn.h.
| pFunctionPointer_t rise | ( | void(*)(void) | fptr ) |
Attach a function to call when a rising edge occurs on the input.
- Parameters:
-
fptr A pointer to a void function, or 0 to set as none
- Returns:
- The function object created for 'fptr'
| pFunctionPointer_t rise_add | ( | void(*)(void) | fptr ) |
Add a function to be called when a rising edge occurs at the end of the call chain.
- Parameters:
-
fptr the function to add
- Returns:
- The function object created for 'fptr'
Definition at line 89 of file InterruptIn.h.
| pFunctionPointer_t rise_add | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) |
Add a function to be called when a rising edge occurs at the end of the call chain.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
- Returns:
- The function object created for 'tptr' and 'mptr'
Definition at line 129 of file InterruptIn.h.
| pFunctionPointer_t rise_add_front | ( | void(*)(void) | fptr ) |
Add a function to be called when a rising edge occurs at the beginning of the call chain.
- Parameters:
-
fptr the function to add
- Returns:
- The function object created for 'fptr'
Definition at line 100 of file InterruptIn.h.
| pFunctionPointer_t rise_add_front | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) |
Add a function to be called when a rising edge occurs at the beginning of the call chain.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
- Returns:
- The function object created for 'tptr' and 'mptr'
Definition at line 142 of file InterruptIn.h.
| bool rise_remove | ( | pFunctionPointer_t | pf ) |
Remove a function from the list of functions to be called when a rising edge occurs.
- Parameters:
-
pf the function object to remove
- Returns:
- true if the function was found and removed, false otherwise
Generated on Thu Jul 14 2022 04:58:45 by
1.7.2