Skip to content

Commit b31b95b

Browse files
committed
Added support for INTERRUPTIN
1 parent 541272f commit b31b95b

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* mbed Microcontroller Library
2+
* SPDX-License-Identifier: BSD-3-Clause
3+
******************************************************************************
4+
*
5+
* Copyright (c) 2017 STMicroelectronics.
6+
* All rights reserved.
7+
*
8+
* This software component is licensed by ST under BSD 3-Clause license,
9+
* the "License"; You may not use this file except in compliance with the
10+
* License. You may obtain a copy of the License at:
11+
* opensource.org/licenses/BSD-3-Clause
12+
*
13+
******************************************************************************
14+
*/
15+
#include "cmsis.h"
16+
#include "gpio_irq_device.h"
17+
18+
// Used to return the index for channels array.
19+
const exti_lines_t pin_lines_desc[16] = {
20+
// EXTI0
21+
{.gpio_idx = 0, .irq_index = 0, .irq_n = EXTI0_IRQn}, // pin 0
22+
// EXTI1
23+
{.gpio_idx = 0, .irq_index = 1, .irq_n = EXTI1_IRQn}, // pin 1
24+
// EXTI2
25+
{.gpio_idx = 0, .irq_index = 2, .irq_n = EXTI2_IRQn}, // pin 2
26+
// EXTI3
27+
{.gpio_idx = 0, .irq_index = 3, .irq_n = EXTI3_IRQn}, // pin 3
28+
// EXTI4
29+
{.gpio_idx = 0, .irq_index = 4, .irq_n = EXTI4_IRQn}, // pin 4
30+
// EXTI5_9
31+
{.gpio_idx = 0, .irq_index = 5, .irq_n = EXTI9_5_IRQn},// pin 5
32+
{.gpio_idx = 1, .irq_index = 5, .irq_n = EXTI9_5_IRQn},// pin 6
33+
{.gpio_idx = 2, .irq_index = 5, .irq_n = EXTI9_5_IRQn},// pin 7
34+
{.gpio_idx = 3, .irq_index = 5, .irq_n = EXTI9_5_IRQn},// pin 8
35+
{.gpio_idx = 4, .irq_index = 5, .irq_n = EXTI9_5_IRQn},// pin 9
36+
// EXTI10_15
37+
{.gpio_idx = 0, .irq_index = 6, .irq_n = EXTI15_10_IRQn},// pin 10
38+
{.gpio_idx = 1, .irq_index = 6, .irq_n = EXTI15_10_IRQn},// pin 11
39+
{.gpio_idx = 2, .irq_index = 6, .irq_n = EXTI15_10_IRQn},// pin 12
40+
{.gpio_idx = 3, .irq_index = 6, .irq_n = EXTI15_10_IRQn},// pin 13
41+
{.gpio_idx = 4, .irq_index = 6, .irq_n = EXTI15_10_IRQn},// pin 14
42+
{.gpio_idx = 5, .irq_index = 6, .irq_n = EXTI15_10_IRQn} // pin 15
43+
};
44+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* mbed Microcontroller Library
2+
* SPDX-License-Identifier: BSD-3-Clause
3+
******************************************************************************
4+
*
5+
* Copyright (c) 2017 STMicroelectronics.
6+
* All rights reserved.
7+
*
8+
* This software component is licensed by ST under BSD 3-Clause license,
9+
* the "License"; You may not use this file except in compliance with the
10+
* License. You may obtain a copy of the License at:
11+
* opensource.org/licenses/BSD-3-Clause
12+
*
13+
******************************************************************************
14+
*/
15+
#ifndef MBED_GPIO_IRQ_DEVICE_H
16+
#define MBED_GPIO_IRQ_DEVICE_H
17+
18+
#ifdef __cplusplus
19+
extern "C" {
20+
#endif
21+
22+
#include "stm32g4xx_ll_exti.h"
23+
24+
// Number of EXTI irq vectors (EXTI0, EXTI1, EXTI2, EXTI3, EXTI4, EXTI5_9, EXTI10_15)
25+
#define CHANNEL_NUM (7)
26+
27+
#define EXTI_IRQ0_NUM_LINES 1
28+
#define EXTI_IRQ1_NUM_LINES 1
29+
#define EXTI_IRQ2_NUM_LINES 1
30+
#define EXTI_IRQ3_NUM_LINES 1
31+
#define EXTI_IRQ4_NUM_LINES 1
32+
#define EXTI_IRQ5_NUM_LINES 5
33+
#define EXTI_IRQ6_NUM_LINES 6
34+
35+
// Max pins for one line (max with EXTI10_15)
36+
#define MAX_PIN_LINE (EXTI_IRQ6_NUM_LINES)
37+
38+
/* Structure to describe how the HW EXTI lines are defined in this HW */
39+
typedef struct exti_lines {
40+
uint32_t gpio_idx; // an index entry for each EXIT line
41+
uint32_t irq_index; // the IRQ index
42+
IRQn_Type irq_n; // the corresponding EXTI IRQn
43+
} exti_lines_t;
44+
45+
// Used to return the index for channels array.
46+
extern const exti_lines_t pin_lines_desc[];
47+
48+
#ifdef __cplusplus
49+
}
50+
#endif
51+
52+
#endif

targets/targets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15051,7 +15051,6 @@
1505115051
"MPU"
1505215052
],
1505315053
"device_has_remove": [
15054-
"INTERRUPTIN",
1505515054
"PORTIN",
1505615055
"PORTINOUT",
1505715056
"PORTOUT",

0 commit comments

Comments
 (0)