|
STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
|
← STM32duino documentation
|
Header for interrupt module. More...
#include "stm32_def.h"#include "pinmap.h"#include <functional>Macros | |
| #define | EXTI_IRQ_PRIO 3 |
| Default EXTI IRQ pre-emption priority (Cortex-M0/M0+) | |
| #define | EXTI_IRQ_SUBPRIO 0 |
| Default EXTI IRQ sub-priority. | |
Typedefs | |
| typedef std::function< void(void)> | callback_function_t |
Functions | |
| void | stm32_interrupt_enable (PinName pn, callback_function_t callback, uint32_t mode) |
| Enable the EXTI interrupt on a pin and register its callback. | |
| void | stm32_interrupt_disable (GPIO_TypeDef *port, uint16_t pin) |
| Disable the EXTI interrupt on a pin and clear its callback. | |
Header for interrupt module.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| void stm32_interrupt_disable | ( | GPIO_TypeDef * | port, |
| uint16_t | pin | ||
| ) |
Disable the EXTI interrupt on a pin and clear its callback.
| port | GPIO port of the pin (only used on STM32WB0x and STM32WL3x, where the GPIO IRQ is shared by all the pins of a port). |
| pin | GPIO pin mask (e.g. GPIO_PIN_0) to disable. |
| void stm32_interrupt_enable | ( | PinName | pn, |
| callback_function_t | callback, | ||
| uint32_t | mode | ||
| ) |
Enable the EXTI interrupt on a pin and register its callback.
The pin is configured as an interrupt input, keeping its current pull configuration, and the EXTI IRQ is enabled with EXTI_IRQ_PRIO / EXTI_IRQ_SUBPRIO priorities.
| pn | Pin name (e.g. PA_0) to attach the interrupt to. |
| callback | Function called when the interrupt fires. |
| mode | Trigger mode, e.g. GPIO_MODE_IT_RISING, GPIO_MODE_IT_FALLING or GPIO_MODE_IT_RISING_FALLING (hal_exti_trigger_t when USE_HALV2_DRIVER). |