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. More... | |
InterruptIn (PinName pin, PinMode mode) | |
Create an InterruptIn connected to the specified pin, and the pin configured to the specified mode. More... | |
int | read () |
Read the input, represented as 0 or 1 (int) More... | |
operator int () | |
An operator shorthand for read() More... | |
void | rise (Callback< void()> func) |
Attach a function to call when a rising edge occurs on the input. More... | |
void | fall (Callback< void()> func) |
Attach a function to call when a falling edge occurs on the input. More... | |
void | mode (PinMode pull) |
Set the input pin mode. More... | |
void | enable_irq () |
Enable IRQ. More... | |
void | disable_irq () |
Disable IRQ. More... | |
A digital interrupt input, used to call a function on a rising or falling edge.
Example:
Definition at line 65 of file InterruptIn.h.
InterruptIn | ( | PinName | pin | ) |
Create an InterruptIn connected to the specified pin.
pin | InterruptIn pin to connect to |
InterruptIn | ( | PinName | pin, |
PinMode | mode | ||
) |
Create an InterruptIn connected to the specified pin, and the pin configured to the specified mode.
pin | InterruptIn pin to connect to |
mode | Desired Pin mode configuration. (Valid values could be PullNone, PullDown, PullUp and PullDefault. See PinNames.h for your target for definitions) |
void disable_irq | ( | ) |
Disable IRQ.
This method depends on hardware implementation, might disable one port interrupts. For further information, check gpio_irq_disable().
void enable_irq | ( | ) |
Enable IRQ.
This method depends on hardware implementation, might enable one port interrupts. For further information, check gpio_irq_enable().
void fall | ( | Callback< void()> | func | ) |
Attach a function to call when a falling edge occurs on the input.
func | A pointer to a void function, or 0 to set as none |
void mode | ( | PinMode | pull | ) |
Set the input pin mode.
pull | PullUp, PullDown, PullNone, PullDefault See PinNames.h for your target for definitions) |
operator int | ( | ) |
An operator shorthand for read()
int read | ( | ) |
Read the input, represented as 0 or 1 (int)
void rise | ( | Callback< void()> | func | ) |
Attach a function to call when a rising edge occurs on the input.
func | A pointer to a void function, or 0 to set as none |