2013-12-14 17:53:57 +00:00
|
|
|
/* mbed Microcontroller Library
|
2013-12-19 10:44:15 +00:00
|
|
|
*******************************************************************************
|
|
|
|
* Copyright (c) 2014, STMicroelectronics
|
|
|
|
* All rights reserved.
|
2013-12-14 17:53:57 +00:00
|
|
|
*
|
2013-12-19 10:44:15 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
2013-12-14 17:53:57 +00:00
|
|
|
*
|
2013-12-19 10:44:15 +00:00
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
2013-12-14 17:53:57 +00:00
|
|
|
*
|
2013-12-19 10:44:15 +00:00
|
|
|
* 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.
|
|
|
|
*******************************************************************************
|
2013-12-14 17:53:57 +00:00
|
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "cmsis.h"
|
|
|
|
#include "gpio_irq_api.h"
|
2014-01-27 08:59:07 +00:00
|
|
|
#include "pinmap.h"
|
2014-08-14 14:16:47 +00:00
|
|
|
#include "mbed_error.h"
|
2017-01-19 14:05:26 +00:00
|
|
|
#include "gpio_irq_device.h"
|
2013-12-14 17:53:57 +00:00
|
|
|
|
|
|
|
#define EDGE_NONE (0)
|
|
|
|
#define EDGE_RISE (1)
|
|
|
|
#define EDGE_FALL (2)
|
|
|
|
#define EDGE_BOTH (3)
|
|
|
|
|
|
|
|
|
2015-01-20 20:40:05 +00:00
|
|
|
typedef struct gpio_channel {
|
|
|
|
uint32_t pin_mask; // bitmask representing which pins are configured for receiving interrupts
|
|
|
|
uint32_t channel_ids[MAX_PIN_LINE]; // mbed "gpio_irq_t gpio_irq" field of instance
|
2017-01-20 16:15:02 +00:00
|
|
|
GPIO_TypeDef* channel_gpio[MAX_PIN_LINE]; // base address of gpio port group
|
2015-01-20 20:40:05 +00:00
|
|
|
uint32_t channel_pin[MAX_PIN_LINE]; // pin number in port group
|
|
|
|
} gpio_channel_t;
|
|
|
|
|
2017-01-19 14:05:26 +00:00
|
|
|
static gpio_irq_handler irq_handler;
|
|
|
|
|
2015-01-20 20:40:05 +00:00
|
|
|
static gpio_channel_t channels[CHANNEL_NUM] = {
|
2017-01-19 14:05:26 +00:00
|
|
|
#ifdef EXTI_IRQ0_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0},
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ1_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0},
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ2_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0},
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ3_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0},
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ4_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0},
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ5_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0},
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ6_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
{.pin_mask = 0}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
2015-01-20 20:40:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void handle_interrupt_in(uint32_t irq_index, uint32_t max_num_pin_line)
|
2014-11-13 15:42:32 +00:00
|
|
|
{
|
2015-01-20 20:40:05 +00:00
|
|
|
gpio_channel_t *gpio_channel = &channels[irq_index];
|
|
|
|
uint32_t gpio_idx;
|
2014-04-08 14:05:40 +00:00
|
|
|
|
2015-01-20 20:40:05 +00:00
|
|
|
for (gpio_idx = 0; gpio_idx < max_num_pin_line; gpio_idx++) {
|
|
|
|
uint32_t current_mask = (1 << gpio_idx);
|
|
|
|
|
|
|
|
if (gpio_channel->pin_mask & current_mask) {
|
|
|
|
// Retrieve the gpio and pin that generate the irq
|
|
|
|
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(gpio_channel->channel_gpio[gpio_idx]);
|
|
|
|
uint32_t pin = (uint32_t)(1 << (gpio_channel->channel_pin[gpio_idx]));
|
2014-04-29 09:30:45 +00:00
|
|
|
|
2015-01-20 20:40:05 +00:00
|
|
|
// Clear interrupt flag
|
2017-02-06 10:49:34 +00:00
|
|
|
if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) {
|
2015-03-06 09:11:35 +00:00
|
|
|
__HAL_GPIO_EXTI_CLEAR_FLAG(pin);
|
2014-04-29 09:30:45 +00:00
|
|
|
|
2017-06-30 07:52:45 +00:00
|
|
|
if (gpio_channel->channel_ids[gpio_idx] == 0) {
|
2017-01-19 14:05:26 +00:00
|
|
|
continue;
|
2017-06-30 07:52:45 +00:00
|
|
|
}
|
2015-01-20 20:40:05 +00:00
|
|
|
|
|
|
|
// Check which edge has generated the irq
|
2017-02-06 10:49:34 +00:00
|
|
|
if ((gpio->IDR & pin) == 0) {
|
2015-01-20 20:40:05 +00:00
|
|
|
irq_handler(gpio_channel->channel_ids[gpio_idx], IRQ_FALL);
|
2017-02-06 10:49:34 +00:00
|
|
|
} else {
|
2015-01-20 20:40:05 +00:00
|
|
|
irq_handler(gpio_channel->channel_ids[gpio_idx], IRQ_RISE);
|
|
|
|
}
|
2017-06-30 07:52:45 +00:00
|
|
|
return;
|
2015-01-20 20:40:05 +00:00
|
|
|
}
|
|
|
|
}
|
2013-12-14 17:53:57 +00:00
|
|
|
}
|
2017-06-30 07:52:45 +00:00
|
|
|
error("Unexpected Spurious interrupt, index %d\r\n", irq_index);
|
2013-12-14 17:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-01-19 14:05:26 +00:00
|
|
|
|
|
|
|
#ifdef EXTI_IRQ0_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI line 0
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq0(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(0, EXTI_IRQ0_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ1_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI line 1
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq1(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(1, EXTI_IRQ1_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ2_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI line 2
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq2(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(2, EXTI_IRQ2_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ3_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI line 3
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq3(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(3, EXTI_IRQ3_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ4_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI line 4
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq4(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(4, EXTI_IRQ4_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ5_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI lines 5 to 9
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq5(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(5, EXTI_IRQ5_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ6_NUM_LINES
|
2015-01-20 20:40:05 +00:00
|
|
|
// EXTI lines 10 to 15
|
2014-11-13 15:42:32 +00:00
|
|
|
static void gpio_irq6(void)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
handle_interrupt_in(6, EXTI_IRQ6_NUM_LINES);
|
2014-04-29 09:30:45 +00:00
|
|
|
}
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
2014-01-27 08:59:07 +00:00
|
|
|
|
2017-01-20 16:15:02 +00:00
|
|
|
extern GPIO_TypeDef *Set_GPIO_Clock(uint32_t port_idx);
|
2016-10-17 11:15:18 +00:00
|
|
|
extern void pin_function_gpiomode(PinName pin, uint32_t gpiomode);
|
2013-12-14 17:53:57 +00:00
|
|
|
|
2014-11-13 15:42:32 +00:00
|
|
|
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id)
|
|
|
|
{
|
2013-12-14 17:53:57 +00:00
|
|
|
uint32_t vector = 0;
|
2014-01-27 08:59:07 +00:00
|
|
|
uint32_t irq_index;
|
2015-01-20 20:40:05 +00:00
|
|
|
gpio_channel_t *gpio_channel;
|
|
|
|
uint32_t gpio_idx;
|
2014-01-27 08:59:07 +00:00
|
|
|
|
2013-12-14 17:53:57 +00:00
|
|
|
if (pin == NC) return -1;
|
|
|
|
|
2017-01-23 10:54:30 +00:00
|
|
|
/* Enable SYSCFG Clock */
|
|
|
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
|
|
|
|
|
|
|
uint32_t port_index = STM_PORT(pin);
|
2014-01-22 06:48:10 +00:00
|
|
|
uint32_t pin_index = STM_PIN(pin);
|
2017-01-19 14:05:26 +00:00
|
|
|
irq_index = pin_lines_desc[pin_index].irq_index;
|
2014-01-27 08:59:07 +00:00
|
|
|
|
2017-02-06 10:49:34 +00:00
|
|
|
switch (irq_index) {
|
2017-01-19 14:05:26 +00:00
|
|
|
#ifdef EXTI_IRQ0_NUM_LINES
|
2014-04-08 14:05:40 +00:00
|
|
|
case 0:
|
2013-12-14 17:53:57 +00:00
|
|
|
vector = (uint32_t)&gpio_irq0;
|
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ1_NUM_LINES
|
2014-04-08 14:05:40 +00:00
|
|
|
case 1:
|
2014-01-27 08:59:07 +00:00
|
|
|
vector = (uint32_t)&gpio_irq1;
|
2013-12-14 17:53:57 +00:00
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ2_NUM_LINES
|
2014-04-08 14:05:40 +00:00
|
|
|
case 2:
|
2014-01-27 08:59:07 +00:00
|
|
|
vector = (uint32_t)&gpio_irq2;
|
2013-12-14 17:53:57 +00:00
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ3_NUM_LINES
|
2014-04-08 14:05:40 +00:00
|
|
|
case 3:
|
2014-01-27 08:59:07 +00:00
|
|
|
vector = (uint32_t)&gpio_irq3;
|
2013-12-14 17:53:57 +00:00
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ4_NUM_LINES
|
2014-04-08 14:05:40 +00:00
|
|
|
case 4:
|
|
|
|
vector = (uint32_t)&gpio_irq4;
|
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ5_NUM_LINES
|
2014-04-08 14:05:40 +00:00
|
|
|
case 5:
|
|
|
|
vector = (uint32_t)&gpio_irq5;
|
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef EXTI_IRQ6_NUM_LINES
|
|
|
|
case 6:
|
2014-04-08 14:05:40 +00:00
|
|
|
vector = (uint32_t)&gpio_irq6;
|
|
|
|
break;
|
2017-01-19 14:05:26 +00:00
|
|
|
#endif
|
2013-12-14 17:53:57 +00:00
|
|
|
default:
|
2014-04-08 14:05:40 +00:00
|
|
|
error("InterruptIn error: pin not supported.\n");
|
2013-12-14 17:53:57 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2014-01-27 08:59:07 +00:00
|
|
|
|
|
|
|
// Enable GPIO clock
|
2017-01-20 16:15:02 +00:00
|
|
|
GPIO_TypeDef *gpio_add = Set_GPIO_Clock(port_index);
|
2014-04-29 09:30:45 +00:00
|
|
|
|
2014-01-27 08:59:07 +00:00
|
|
|
// Save informations for future use
|
2017-01-19 14:05:26 +00:00
|
|
|
obj->irq_n = pin_lines_desc[pin_index].irq_n;
|
|
|
|
obj->irq_index = pin_lines_desc[pin_index].irq_index;
|
2013-12-14 17:53:57 +00:00
|
|
|
obj->event = EDGE_NONE;
|
2015-01-26 20:46:06 +00:00
|
|
|
obj->pin = pin;
|
|
|
|
|
2015-01-20 20:40:05 +00:00
|
|
|
gpio_channel = &channels[irq_index];
|
2017-01-19 14:05:26 +00:00
|
|
|
gpio_idx = pin_lines_desc[pin_index].gpio_idx;
|
2015-01-20 20:40:05 +00:00
|
|
|
gpio_channel->pin_mask |= (1 << gpio_idx);
|
|
|
|
gpio_channel->channel_ids[gpio_idx] = id;
|
|
|
|
gpio_channel->channel_gpio[gpio_idx] = gpio_add;
|
|
|
|
gpio_channel->channel_pin[gpio_idx] = pin_index;
|
2014-04-29 09:30:45 +00:00
|
|
|
|
|
|
|
irq_handler = handler;
|
|
|
|
|
2017-01-19 14:05:26 +00:00
|
|
|
// Enable EXTI interrupt
|
|
|
|
NVIC_SetVector(obj->irq_n, vector);
|
2017-01-23 10:54:30 +00:00
|
|
|
gpio_irq_enable(obj);
|
2017-01-19 14:05:26 +00:00
|
|
|
|
2013-12-14 17:53:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-11-13 15:42:32 +00:00
|
|
|
void gpio_irq_free(gpio_irq_t *obj)
|
|
|
|
{
|
2017-01-19 14:05:26 +00:00
|
|
|
uint32_t gpio_idx = pin_lines_desc[STM_PIN(obj->pin)].gpio_idx;
|
2017-01-23 10:54:30 +00:00
|
|
|
gpio_channel_t *gpio_channel = &channels[obj->irq_index];
|
|
|
|
|
|
|
|
gpio_irq_disable(obj);
|
2015-01-20 20:40:05 +00:00
|
|
|
gpio_channel->pin_mask &= ~(1 << gpio_idx);
|
|
|
|
gpio_channel->channel_ids[gpio_idx] = 0;
|
|
|
|
gpio_channel->channel_gpio[gpio_idx] = 0;
|
|
|
|
gpio_channel->channel_pin[gpio_idx] = 0;
|
2013-12-14 17:53:57 +00:00
|
|
|
}
|
|
|
|
|
2014-11-13 15:42:32 +00:00
|
|
|
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
|
|
|
|
{
|
2017-06-30 11:23:08 +00:00
|
|
|
/* Enable / Disable Edge triggered interrupt and store event */
|
2017-02-06 10:49:34 +00:00
|
|
|
if (event == IRQ_RISE) {
|
|
|
|
if (enable) {
|
2017-01-23 10:54:30 +00:00
|
|
|
LL_EXTI_EnableRisingTrig_0_31(1 << STM_PIN(obj->pin));
|
2017-06-30 11:23:08 +00:00
|
|
|
obj->event |= IRQ_RISE;
|
2017-02-06 10:49:34 +00:00
|
|
|
} else {
|
2017-01-23 10:54:30 +00:00
|
|
|
LL_EXTI_DisableRisingTrig_0_31(1 << STM_PIN(obj->pin));
|
2017-06-30 11:23:08 +00:00
|
|
|
obj->event &= ~IRQ_RISE;
|
2013-12-14 17:53:57 +00:00
|
|
|
}
|
2017-01-23 10:54:30 +00:00
|
|
|
}
|
2017-02-06 10:49:34 +00:00
|
|
|
if (event == IRQ_FALL) {
|
|
|
|
if (enable) {
|
2017-01-23 10:54:30 +00:00
|
|
|
LL_EXTI_EnableFallingTrig_0_31(1 << STM_PIN(obj->pin));
|
2017-06-30 11:23:08 +00:00
|
|
|
obj->event |= IRQ_FALL;
|
2017-02-06 10:49:34 +00:00
|
|
|
} else {
|
2017-01-23 10:54:30 +00:00
|
|
|
LL_EXTI_DisableFallingTrig_0_31(1 << STM_PIN(obj->pin));
|
2017-06-30 11:23:08 +00:00
|
|
|
obj->event &= ~IRQ_FALL;
|
2014-11-13 15:42:32 +00:00
|
|
|
}
|
2013-12-14 17:53:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-13 15:42:32 +00:00
|
|
|
void gpio_irq_enable(gpio_irq_t *obj)
|
|
|
|
{
|
2017-01-23 10:54:30 +00:00
|
|
|
uint32_t temp = 0;
|
|
|
|
uint32_t port_index = STM_PORT(obj->pin);
|
|
|
|
uint32_t pin_index = STM_PIN(obj->pin);
|
|
|
|
|
|
|
|
/* Select Source */
|
|
|
|
temp = SYSCFG->EXTICR[pin_index >> 2];
|
|
|
|
CLEAR_BIT(temp, (0x0FU) << (4U * (pin_index & 0x03U)));
|
|
|
|
SET_BIT(temp, port_index << (4U * (pin_index & 0x03U)));
|
|
|
|
SYSCFG->EXTICR[pin_index >> 2] = temp;
|
|
|
|
|
|
|
|
LL_EXTI_EnableIT_0_31(1 << pin_index);
|
|
|
|
|
2017-06-30 11:23:08 +00:00
|
|
|
/* Restore previous edge interrupt configuration if applicable */
|
|
|
|
if (obj->event & IRQ_RISE) {
|
|
|
|
LL_EXTI_EnableRisingTrig_0_31(1 << STM_PIN(obj->pin));
|
|
|
|
}
|
|
|
|
if (obj->event & IRQ_FALL) {
|
2017-07-07 15:27:46 +00:00
|
|
|
LL_EXTI_EnableFallingTrig_0_31(1 << STM_PIN(obj->pin));
|
2017-06-30 11:23:08 +00:00
|
|
|
}
|
|
|
|
|
2013-12-14 17:53:57 +00:00
|
|
|
NVIC_EnableIRQ(obj->irq_n);
|
|
|
|
}
|
|
|
|
|
2014-11-13 15:42:32 +00:00
|
|
|
void gpio_irq_disable(gpio_irq_t *obj)
|
|
|
|
{
|
2017-01-23 10:54:30 +00:00
|
|
|
/* Clear EXTI line configuration */
|
2017-06-30 07:37:26 +00:00
|
|
|
LL_EXTI_DisableRisingTrig_0_31(1 << STM_PIN(obj->pin));
|
|
|
|
LL_EXTI_DisableFallingTrig_0_31(1 << STM_PIN(obj->pin));
|
2017-01-23 10:54:30 +00:00
|
|
|
LL_EXTI_DisableIT_0_31(1 << STM_PIN(obj->pin));
|
2013-12-14 17:53:57 +00:00
|
|
|
NVIC_DisableIRQ(obj->irq_n);
|
2017-01-23 10:54:30 +00:00
|
|
|
NVIC_ClearPendingIRQ(obj->irq_n);
|
2013-12-14 17:53:57 +00:00
|
|
|
}
|