attachInterrupt(), detachInterrupt(), interrupts(), noInterrupts(). More...
Macros | |
| #define | interrupts() |
| #define | noInterrupts() |
| #define | digitalPinToInterrupt(pin) |
Functions | |
| void | attachInterrupt (pin_size_t interruptNumber, voidFuncPtr callback, PinStatus mode) |
| Calls a function when the level on a pin changes. | |
| void | attachInterruptParam (pin_size_t interruptNumber, voidFuncPtrParam callback, PinStatus mode, void *param) |
| Same as attachInterrupt(), but the function is called with param. | |
| void | detachInterrupt (pin_size_t interruptNumber) |
| Stops calling the function attached to a pin. | |
| #define digitalPinToInterrupt | ( | pin | ) |
Interrupt number for attachInterrupt(): every pin can interrupt, so it is the pin itself.
| #define interrupts | ( | ) |
Enables interrupts again after noInterrupts().
| #define noInterrupts | ( | ) |
Disables interrupts, for example while reading a variable an interrupt changes. Keep the section short: USB Serial, attachInterrupt() functions and tone() durations wait until interrupts() (millis() keeps counting). Only the calling core is affected: the other core keeps running (Multicore).
| void attachInterrupt | ( | pin_size_t | interruptNumber, |
| voidFuncPtr | callback, | ||
| PinStatus | mode ) |
Calls a function when the level on a pin changes.
Unlike an Uno (D2 and D3 only), every pin except A3-A5 can interrupt. Replaces any function already attached to the pin.
| interruptNumber | digitalPinToInterrupt(pin), which is just the pin number. |
| callback | Function to call; nullptr is ignored. |
| mode | RISING, FALLING or CHANGE; or LOW or HIGH, which call the function again as soon as it returns, for as long as the level lasts. |
| void attachInterruptParam | ( | pin_size_t | interruptNumber, |
| voidFuncPtrParam | callback, | ||
| PinStatus | mode, | ||
| void * | param ) |
Same as attachInterrupt(), but the function is called with param.
| interruptNumber | digitalPinToInterrupt(pin), which is just the pin number. |
| callback | Function taking a void*; nullptr is ignored. |
| mode | As for attachInterrupt(). |
| param | Passed to callback on every call. |
| void detachInterrupt | ( | pin_size_t | interruptNumber | ) |
Stops calling the function attached to a pin.
| interruptNumber | digitalPinToInterrupt(pin), which is just the pin number. |