mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/gpio_irq_api.c@162:937d965048d3, 2014-04-22 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Apr 22 13:30:06 2014 +0100
- Revision:
- 162:937d965048d3
- Parent:
- 158:3121b9889f7b
- Child:
- 250:a49055e7a707
Synchronized with git revision 6b9fca177ab428a93a520d666ca5b4aeb921da51
Full URL: https://github.com/mbedmicro/mbed/commit/6b9fca177ab428a93a520d666ca5b4aeb921da51/
Update gpio_irq_api.c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 125:23cc3068a9e4 | 1 | /* mbed Microcontroller Library |
mbed_official | 125:23cc3068a9e4 | 2 | ******************************************************************************* |
mbed_official | 125:23cc3068a9e4 | 3 | * Copyright (c) 2014, STMicroelectronics |
mbed_official | 125:23cc3068a9e4 | 4 | * All rights reserved. |
mbed_official | 125:23cc3068a9e4 | 5 | * |
mbed_official | 125:23cc3068a9e4 | 6 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 125:23cc3068a9e4 | 7 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 125:23cc3068a9e4 | 8 | * |
mbed_official | 125:23cc3068a9e4 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 125:23cc3068a9e4 | 10 | * this list of conditions and the following disclaimer. |
mbed_official | 125:23cc3068a9e4 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 125:23cc3068a9e4 | 12 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 125:23cc3068a9e4 | 13 | * and/or other materials provided with the distribution. |
mbed_official | 125:23cc3068a9e4 | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 125:23cc3068a9e4 | 15 | * may be used to endorse or promote products derived from this software |
mbed_official | 125:23cc3068a9e4 | 16 | * without specific prior written permission. |
mbed_official | 125:23cc3068a9e4 | 17 | * |
mbed_official | 125:23cc3068a9e4 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 125:23cc3068a9e4 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 125:23cc3068a9e4 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 125:23cc3068a9e4 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 125:23cc3068a9e4 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 125:23cc3068a9e4 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 125:23cc3068a9e4 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 125:23cc3068a9e4 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 125:23cc3068a9e4 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 125:23cc3068a9e4 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 125:23cc3068a9e4 | 28 | ******************************************************************************* |
mbed_official | 125:23cc3068a9e4 | 29 | */ |
mbed_official | 125:23cc3068a9e4 | 30 | #include <stddef.h> |
mbed_official | 125:23cc3068a9e4 | 31 | #include "cmsis.h" |
mbed_official | 125:23cc3068a9e4 | 32 | #include "gpio_irq_api.h" |
mbed_official | 125:23cc3068a9e4 | 33 | #include "pinmap.h" |
mbed_official | 125:23cc3068a9e4 | 34 | #include "error.h" |
mbed_official | 125:23cc3068a9e4 | 35 | |
mbed_official | 125:23cc3068a9e4 | 36 | #define EDGE_NONE (0) |
mbed_official | 125:23cc3068a9e4 | 37 | #define EDGE_RISE (1) |
mbed_official | 125:23cc3068a9e4 | 38 | #define EDGE_FALL (2) |
mbed_official | 125:23cc3068a9e4 | 39 | #define EDGE_BOTH (3) |
mbed_official | 125:23cc3068a9e4 | 40 | |
mbed_official | 125:23cc3068a9e4 | 41 | #define CHANNEL_NUM (7) |
mbed_official | 125:23cc3068a9e4 | 42 | |
mbed_official | 125:23cc3068a9e4 | 43 | static uint32_t channel_ids[CHANNEL_NUM] = {0, 0, 0, 0, 0, 0, 0}; |
mbed_official | 125:23cc3068a9e4 | 44 | static uint32_t channel_gpio[CHANNEL_NUM] = {0, 0, 0, 0, 0, 0, 0}; |
mbed_official | 125:23cc3068a9e4 | 45 | static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0, 0, 0, 0, 0}; |
mbed_official | 125:23cc3068a9e4 | 46 | |
mbed_official | 125:23cc3068a9e4 | 47 | static gpio_irq_handler irq_handler; |
mbed_official | 125:23cc3068a9e4 | 48 | |
mbed_official | 125:23cc3068a9e4 | 49 | static void handle_interrupt_in(uint32_t irq_index) { |
mbed_official | 125:23cc3068a9e4 | 50 | // Retrieve the gpio and pin that generate the irq |
mbed_official | 125:23cc3068a9e4 | 51 | GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]); |
mbed_official | 125:23cc3068a9e4 | 52 | uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]); |
mbed_official | 125:23cc3068a9e4 | 53 | |
mbed_official | 125:23cc3068a9e4 | 54 | // Clear interrupt flag |
mbed_official | 135:067cc8ba23da | 55 | if (EXTI_GetITStatus(channel_pin[irq_index]) != RESET) { |
mbed_official | 125:23cc3068a9e4 | 56 | EXTI_ClearITPendingBit(channel_pin[irq_index]); |
mbed_official | 125:23cc3068a9e4 | 57 | } |
mbed_official | 135:067cc8ba23da | 58 | |
mbed_official | 125:23cc3068a9e4 | 59 | if (channel_ids[irq_index] == 0) return; |
mbed_official | 135:067cc8ba23da | 60 | |
mbed_official | 125:23cc3068a9e4 | 61 | // Check which edge has generated the irq |
mbed_official | 125:23cc3068a9e4 | 62 | if ((gpio->IDR & pin) == 0) { |
mbed_official | 125:23cc3068a9e4 | 63 | irq_handler(channel_ids[irq_index], IRQ_FALL); |
mbed_official | 135:067cc8ba23da | 64 | } else { |
mbed_official | 125:23cc3068a9e4 | 65 | irq_handler(channel_ids[irq_index], IRQ_RISE); |
mbed_official | 125:23cc3068a9e4 | 66 | } |
mbed_official | 125:23cc3068a9e4 | 67 | } |
mbed_official | 125:23cc3068a9e4 | 68 | |
mbed_official | 135:067cc8ba23da | 69 | static void gpio_irq0(void) { |
mbed_official | 135:067cc8ba23da | 70 | handle_interrupt_in(0); // EXTI line 0 |
mbed_official | 135:067cc8ba23da | 71 | } |
mbed_official | 135:067cc8ba23da | 72 | |
mbed_official | 135:067cc8ba23da | 73 | static void gpio_irq1(void) { |
mbed_official | 135:067cc8ba23da | 74 | handle_interrupt_in(1); // EXTI line 1 |
mbed_official | 135:067cc8ba23da | 75 | } |
mbed_official | 135:067cc8ba23da | 76 | |
mbed_official | 135:067cc8ba23da | 77 | static void gpio_irq2(void) { |
mbed_official | 135:067cc8ba23da | 78 | handle_interrupt_in(2); // EXTI line 2 |
mbed_official | 135:067cc8ba23da | 79 | } |
mbed_official | 135:067cc8ba23da | 80 | |
mbed_official | 135:067cc8ba23da | 81 | static void gpio_irq3(void) { |
mbed_official | 135:067cc8ba23da | 82 | handle_interrupt_in(3); // EXTI line 3 |
mbed_official | 135:067cc8ba23da | 83 | } |
mbed_official | 135:067cc8ba23da | 84 | |
mbed_official | 135:067cc8ba23da | 85 | static void gpio_irq4(void) { |
mbed_official | 135:067cc8ba23da | 86 | handle_interrupt_in(4); // EXTI line 4 |
mbed_official | 135:067cc8ba23da | 87 | } |
mbed_official | 135:067cc8ba23da | 88 | |
mbed_official | 135:067cc8ba23da | 89 | static void gpio_irq5(void) { |
mbed_official | 135:067cc8ba23da | 90 | handle_interrupt_in(5); // EXTI lines 5 to 9 |
mbed_official | 135:067cc8ba23da | 91 | } |
mbed_official | 135:067cc8ba23da | 92 | |
mbed_official | 135:067cc8ba23da | 93 | static void gpio_irq6(void) { |
mbed_official | 135:067cc8ba23da | 94 | handle_interrupt_in(6); // EXTI lines 10 to 15 |
mbed_official | 135:067cc8ba23da | 95 | } |
mbed_official | 125:23cc3068a9e4 | 96 | |
mbed_official | 125:23cc3068a9e4 | 97 | extern uint32_t Set_GPIO_Clock(uint32_t port_idx); |
mbed_official | 125:23cc3068a9e4 | 98 | |
mbed_official | 125:23cc3068a9e4 | 99 | int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) { |
mbed_official | 125:23cc3068a9e4 | 100 | IRQn_Type irq_n = (IRQn_Type)0; |
mbed_official | 125:23cc3068a9e4 | 101 | uint32_t vector = 0; |
mbed_official | 125:23cc3068a9e4 | 102 | uint32_t irq_index; |
mbed_official | 125:23cc3068a9e4 | 103 | |
mbed_official | 125:23cc3068a9e4 | 104 | if (pin == NC) return -1; |
mbed_official | 125:23cc3068a9e4 | 105 | |
mbed_official | 125:23cc3068a9e4 | 106 | uint32_t port_index = STM_PORT(pin); |
mbed_official | 125:23cc3068a9e4 | 107 | uint32_t pin_index = STM_PIN(pin); |
mbed_official | 125:23cc3068a9e4 | 108 | |
mbed_official | 125:23cc3068a9e4 | 109 | // Select irq number and interrupt routine |
mbed_official | 125:23cc3068a9e4 | 110 | switch (pin_index) { |
mbed_official | 125:23cc3068a9e4 | 111 | case 0: |
mbed_official | 125:23cc3068a9e4 | 112 | irq_n = EXTI0_IRQn; |
mbed_official | 125:23cc3068a9e4 | 113 | vector = (uint32_t)&gpio_irq0; |
mbed_official | 125:23cc3068a9e4 | 114 | irq_index = 0; |
mbed_official | 125:23cc3068a9e4 | 115 | break; |
mbed_official | 125:23cc3068a9e4 | 116 | case 1: |
mbed_official | 125:23cc3068a9e4 | 117 | irq_n = EXTI1_IRQn; |
mbed_official | 125:23cc3068a9e4 | 118 | vector = (uint32_t)&gpio_irq1; |
mbed_official | 125:23cc3068a9e4 | 119 | irq_index = 1; |
mbed_official | 125:23cc3068a9e4 | 120 | break; |
mbed_official | 125:23cc3068a9e4 | 121 | case 2: |
mbed_official | 125:23cc3068a9e4 | 122 | irq_n = EXTI2_TS_IRQn; |
mbed_official | 125:23cc3068a9e4 | 123 | vector = (uint32_t)&gpio_irq2; |
mbed_official | 125:23cc3068a9e4 | 124 | irq_index = 2; |
mbed_official | 125:23cc3068a9e4 | 125 | break; |
mbed_official | 125:23cc3068a9e4 | 126 | case 3: |
mbed_official | 125:23cc3068a9e4 | 127 | irq_n = EXTI3_IRQn; |
mbed_official | 125:23cc3068a9e4 | 128 | vector = (uint32_t)&gpio_irq3; |
mbed_official | 125:23cc3068a9e4 | 129 | irq_index = 3; |
mbed_official | 125:23cc3068a9e4 | 130 | break; |
mbed_official | 125:23cc3068a9e4 | 131 | case 4: |
mbed_official | 125:23cc3068a9e4 | 132 | irq_n = EXTI4_IRQn; |
mbed_official | 125:23cc3068a9e4 | 133 | vector = (uint32_t)&gpio_irq4; |
mbed_official | 125:23cc3068a9e4 | 134 | irq_index = 4; |
mbed_official | 125:23cc3068a9e4 | 135 | break; |
mbed_official | 125:23cc3068a9e4 | 136 | case 5: |
mbed_official | 125:23cc3068a9e4 | 137 | case 6: |
mbed_official | 125:23cc3068a9e4 | 138 | case 7: |
mbed_official | 125:23cc3068a9e4 | 139 | case 8: |
mbed_official | 125:23cc3068a9e4 | 140 | case 9: |
mbed_official | 125:23cc3068a9e4 | 141 | irq_n = EXTI9_5_IRQn; |
mbed_official | 125:23cc3068a9e4 | 142 | vector = (uint32_t)&gpio_irq5; |
mbed_official | 125:23cc3068a9e4 | 143 | irq_index = 5; |
mbed_official | 125:23cc3068a9e4 | 144 | break; |
mbed_official | 125:23cc3068a9e4 | 145 | case 10: |
mbed_official | 125:23cc3068a9e4 | 146 | case 11: |
mbed_official | 125:23cc3068a9e4 | 147 | case 12: |
mbed_official | 125:23cc3068a9e4 | 148 | case 13: |
mbed_official | 125:23cc3068a9e4 | 149 | case 14: |
mbed_official | 125:23cc3068a9e4 | 150 | case 15: |
mbed_official | 125:23cc3068a9e4 | 151 | irq_n = EXTI15_10_IRQn; |
mbed_official | 125:23cc3068a9e4 | 152 | vector = (uint32_t)&gpio_irq6; |
mbed_official | 125:23cc3068a9e4 | 153 | irq_index = 6; |
mbed_official | 125:23cc3068a9e4 | 154 | break; |
mbed_official | 125:23cc3068a9e4 | 155 | default: |
mbed_official | 158:3121b9889f7b | 156 | error("This pin is not supported with InterruptIn."); |
mbed_official | 125:23cc3068a9e4 | 157 | return -1; |
mbed_official | 125:23cc3068a9e4 | 158 | } |
mbed_official | 125:23cc3068a9e4 | 159 | |
mbed_official | 125:23cc3068a9e4 | 160 | // Enable GPIO clock |
mbed_official | 125:23cc3068a9e4 | 161 | uint32_t gpio_add = Set_GPIO_Clock(port_index); |
mbed_official | 125:23cc3068a9e4 | 162 | |
mbed_official | 125:23cc3068a9e4 | 163 | // Enable SYSCFG clock |
mbed_official | 125:23cc3068a9e4 | 164 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); |
mbed_official | 135:067cc8ba23da | 165 | |
mbed_official | 125:23cc3068a9e4 | 166 | // Connect EXTI line to pin |
mbed_official | 125:23cc3068a9e4 | 167 | SYSCFG_EXTILineConfig(port_index, pin_index); |
mbed_official | 125:23cc3068a9e4 | 168 | |
mbed_official | 125:23cc3068a9e4 | 169 | // Configure EXTI line |
mbed_official | 135:067cc8ba23da | 170 | EXTI_InitTypeDef EXTI_InitStructure; |
mbed_official | 125:23cc3068a9e4 | 171 | EXTI_InitStructure.EXTI_Line = pin_index; |
mbed_official | 125:23cc3068a9e4 | 172 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; |
mbed_official | 125:23cc3068a9e4 | 173 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; |
mbed_official | 125:23cc3068a9e4 | 174 | EXTI_InitStructure.EXTI_LineCmd = ENABLE; |
mbed_official | 125:23cc3068a9e4 | 175 | EXTI_Init(&EXTI_InitStructure); |
mbed_official | 135:067cc8ba23da | 176 | |
mbed_official | 125:23cc3068a9e4 | 177 | // Enable and set EXTI interrupt to the lowest priority |
mbed_official | 125:23cc3068a9e4 | 178 | NVIC_InitTypeDef NVIC_InitStructure; |
mbed_official | 125:23cc3068a9e4 | 179 | NVIC_InitStructure.NVIC_IRQChannel = irq_n; |
mbed_official | 125:23cc3068a9e4 | 180 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; |
mbed_official | 125:23cc3068a9e4 | 181 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; |
mbed_official | 125:23cc3068a9e4 | 182 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; |
mbed_official | 125:23cc3068a9e4 | 183 | NVIC_Init(&NVIC_InitStructure); |
mbed_official | 135:067cc8ba23da | 184 | |
mbed_official | 125:23cc3068a9e4 | 185 | NVIC_SetVector(irq_n, vector); |
mbed_official | 125:23cc3068a9e4 | 186 | NVIC_EnableIRQ(irq_n); |
mbed_official | 125:23cc3068a9e4 | 187 | |
mbed_official | 125:23cc3068a9e4 | 188 | // Save informations for future use |
mbed_official | 125:23cc3068a9e4 | 189 | obj->irq_n = irq_n; |
mbed_official | 125:23cc3068a9e4 | 190 | obj->irq_index = irq_index; |
mbed_official | 125:23cc3068a9e4 | 191 | obj->event = EDGE_NONE; |
mbed_official | 125:23cc3068a9e4 | 192 | channel_ids[irq_index] = id; |
mbed_official | 125:23cc3068a9e4 | 193 | channel_gpio[irq_index] = gpio_add; |
mbed_official | 125:23cc3068a9e4 | 194 | channel_pin[irq_index] = pin_index; |
mbed_official | 135:067cc8ba23da | 195 | |
mbed_official | 135:067cc8ba23da | 196 | irq_handler = handler; |
mbed_official | 135:067cc8ba23da | 197 | |
mbed_official | 125:23cc3068a9e4 | 198 | return 0; |
mbed_official | 125:23cc3068a9e4 | 199 | } |
mbed_official | 125:23cc3068a9e4 | 200 | |
mbed_official | 125:23cc3068a9e4 | 201 | void gpio_irq_free(gpio_irq_t *obj) { |
mbed_official | 125:23cc3068a9e4 | 202 | channel_ids[obj->irq_index] = 0; |
mbed_official | 125:23cc3068a9e4 | 203 | channel_gpio[obj->irq_index] = 0; |
mbed_official | 125:23cc3068a9e4 | 204 | channel_pin[obj->irq_index] = 0; |
mbed_official | 125:23cc3068a9e4 | 205 | // Disable EXTI line |
mbed_official | 125:23cc3068a9e4 | 206 | EXTI_InitTypeDef EXTI_InitStructure; |
mbed_official | 125:23cc3068a9e4 | 207 | EXTI_StructInit(&EXTI_InitStructure); |
mbed_official | 135:067cc8ba23da | 208 | EXTI_Init(&EXTI_InitStructure); |
mbed_official | 125:23cc3068a9e4 | 209 | obj->event = EDGE_NONE; |
mbed_official | 125:23cc3068a9e4 | 210 | } |
mbed_official | 125:23cc3068a9e4 | 211 | |
mbed_official | 125:23cc3068a9e4 | 212 | void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) { |
mbed_official | 125:23cc3068a9e4 | 213 | EXTI_InitTypeDef EXTI_InitStructure; |
mbed_official | 125:23cc3068a9e4 | 214 | |
mbed_official | 125:23cc3068a9e4 | 215 | EXTI_InitStructure.EXTI_Line = channel_pin[obj->irq_index]; |
mbed_official | 125:23cc3068a9e4 | 216 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; |
mbed_official | 135:067cc8ba23da | 217 | |
mbed_official | 125:23cc3068a9e4 | 218 | if (event == IRQ_RISE) { |
mbed_official | 125:23cc3068a9e4 | 219 | if ((obj->event == EDGE_FALL) || (obj->event == EDGE_BOTH)) { |
mbed_official | 125:23cc3068a9e4 | 220 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; |
mbed_official | 125:23cc3068a9e4 | 221 | obj->event = EDGE_BOTH; |
mbed_official | 135:067cc8ba23da | 222 | } else { // NONE or RISE |
mbed_official | 125:23cc3068a9e4 | 223 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; |
mbed_official | 125:23cc3068a9e4 | 224 | obj->event = EDGE_RISE; |
mbed_official | 125:23cc3068a9e4 | 225 | } |
mbed_official | 125:23cc3068a9e4 | 226 | } |
mbed_official | 135:067cc8ba23da | 227 | |
mbed_official | 125:23cc3068a9e4 | 228 | if (event == IRQ_FALL) { |
mbed_official | 125:23cc3068a9e4 | 229 | if ((obj->event == EDGE_RISE) || (obj->event == EDGE_BOTH)) { |
mbed_official | 125:23cc3068a9e4 | 230 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; |
mbed_official | 125:23cc3068a9e4 | 231 | obj->event = EDGE_BOTH; |
mbed_official | 135:067cc8ba23da | 232 | } else { // NONE or FALL |
mbed_official | 125:23cc3068a9e4 | 233 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; |
mbed_official | 125:23cc3068a9e4 | 234 | obj->event = EDGE_FALL; |
mbed_official | 125:23cc3068a9e4 | 235 | } |
mbed_official | 125:23cc3068a9e4 | 236 | } |
mbed_official | 135:067cc8ba23da | 237 | |
mbed_official | 125:23cc3068a9e4 | 238 | if (enable) { |
mbed_official | 125:23cc3068a9e4 | 239 | EXTI_InitStructure.EXTI_LineCmd = ENABLE; |
mbed_official | 135:067cc8ba23da | 240 | } else { |
mbed_official | 125:23cc3068a9e4 | 241 | EXTI_InitStructure.EXTI_LineCmd = DISABLE; |
mbed_official | 125:23cc3068a9e4 | 242 | } |
mbed_official | 135:067cc8ba23da | 243 | |
mbed_official | 125:23cc3068a9e4 | 244 | EXTI_Init(&EXTI_InitStructure); |
mbed_official | 125:23cc3068a9e4 | 245 | } |
mbed_official | 125:23cc3068a9e4 | 246 | |
mbed_official | 125:23cc3068a9e4 | 247 | void gpio_irq_enable(gpio_irq_t *obj) { |
mbed_official | 125:23cc3068a9e4 | 248 | NVIC_EnableIRQ(obj->irq_n); |
mbed_official | 125:23cc3068a9e4 | 249 | } |
mbed_official | 125:23cc3068a9e4 | 250 | |
mbed_official | 125:23cc3068a9e4 | 251 | void gpio_irq_disable(gpio_irq_t *obj) { |
mbed_official | 125:23cc3068a9e4 | 252 | NVIC_DisableIRQ(obj->irq_n); |
mbed_official | 125:23cc3068a9e4 | 253 | obj->event = EDGE_NONE; |
mbed_official | 125:23cc3068a9e4 | 254 | } |