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: MAX34417_demo MAXREFDES1265 MAXREFDES1265
Fork of mbed-dev by
InterruptIn Class Reference
[Drivers]
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. | |
| int | read () |
| Read the input, represented as 0 or 1 (int) | |
| operator int () | |
| An operator shorthand for read() | |
| void | rise (Callback< void()> func) |
| Attach a function to call when a rising edge occurs on the input. | |
| template<typename T , typename M > | |
| MBED_DEPRECATED_SINCE ("mbed-os-5.1","The rise function does not support cv-qualifiers. Replaced by ""rise(callback(obj, method)).") void rise(T *obj | |
| Attach a member function to call when a rising edge occurs on the input. | |
| void | fall (Callback< void()> func) |
| Attach a function to call when a falling edge occurs on the input. | |
| template<typename T , typename M > | |
| MBED_DEPRECATED_SINCE ("mbed-os-5.1","The fall function does not support cv-qualifiers. Replaced by ""fall(callback(obj, method)).") void fall(T *obj | |
| Attach a member function to call when a falling edge occurs on the input. | |
| void | enable_irq () |
| Enable IRQ. | |
| void | disable_irq () |
| Disable IRQ. | |
Detailed Description
A digital interrupt input, used to call a function on a rising or falling edge.
Synchronization level: Interrupt safe
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 59 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
Definition at line 24 of file InterruptIn.cpp.
Generated on Tue Jul 12 2022 20:41:24 by
1.7.2
