Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
hal/gpio_irq_api.h@1:8a094db1347f, 2020-11-09 (annotated)
- Committer:
- elijahsj
- Date:
- Mon Nov 09 00:02:47 2020 -0500
- Revision:
- 1:8a094db1347f
test
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| elijahsj | 1:8a094db1347f | 1 | |
| elijahsj | 1:8a094db1347f | 2 | /** \addtogroup hal */ |
| elijahsj | 1:8a094db1347f | 3 | /** @{*/ |
| elijahsj | 1:8a094db1347f | 4 | /* mbed Microcontroller Library |
| elijahsj | 1:8a094db1347f | 5 | * Copyright (c) 2006-2013 ARM Limited |
| elijahsj | 1:8a094db1347f | 6 | * |
| elijahsj | 1:8a094db1347f | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| elijahsj | 1:8a094db1347f | 8 | * you may not use this file except in compliance with the License. |
| elijahsj | 1:8a094db1347f | 9 | * You may obtain a copy of the License at |
| elijahsj | 1:8a094db1347f | 10 | * |
| elijahsj | 1:8a094db1347f | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| elijahsj | 1:8a094db1347f | 12 | * |
| elijahsj | 1:8a094db1347f | 13 | * Unless required by applicable law or agreed to in writing, software |
| elijahsj | 1:8a094db1347f | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| elijahsj | 1:8a094db1347f | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| elijahsj | 1:8a094db1347f | 16 | * See the License for the specific language governing permissions and |
| elijahsj | 1:8a094db1347f | 17 | * limitations under the License. |
| elijahsj | 1:8a094db1347f | 18 | */ |
| elijahsj | 1:8a094db1347f | 19 | #ifndef MBED_GPIO_IRQ_API_H |
| elijahsj | 1:8a094db1347f | 20 | #define MBED_GPIO_IRQ_API_H |
| elijahsj | 1:8a094db1347f | 21 | |
| elijahsj | 1:8a094db1347f | 22 | #include "device.h" |
| elijahsj | 1:8a094db1347f | 23 | |
| elijahsj | 1:8a094db1347f | 24 | #if DEVICE_INTERRUPTIN |
| elijahsj | 1:8a094db1347f | 25 | |
| elijahsj | 1:8a094db1347f | 26 | #ifdef __cplusplus |
| elijahsj | 1:8a094db1347f | 27 | extern "C" { |
| elijahsj | 1:8a094db1347f | 28 | #endif |
| elijahsj | 1:8a094db1347f | 29 | |
| elijahsj | 1:8a094db1347f | 30 | /** GPIO IRQ events |
| elijahsj | 1:8a094db1347f | 31 | */ |
| elijahsj | 1:8a094db1347f | 32 | typedef enum { |
| elijahsj | 1:8a094db1347f | 33 | IRQ_NONE, |
| elijahsj | 1:8a094db1347f | 34 | IRQ_RISE, |
| elijahsj | 1:8a094db1347f | 35 | IRQ_FALL |
| elijahsj | 1:8a094db1347f | 36 | } gpio_irq_event; |
| elijahsj | 1:8a094db1347f | 37 | |
| elijahsj | 1:8a094db1347f | 38 | /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL |
| elijahsj | 1:8a094db1347f | 39 | */ |
| elijahsj | 1:8a094db1347f | 40 | typedef struct gpio_irq_s gpio_irq_t; |
| elijahsj | 1:8a094db1347f | 41 | |
| elijahsj | 1:8a094db1347f | 42 | typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event); |
| elijahsj | 1:8a094db1347f | 43 | |
| elijahsj | 1:8a094db1347f | 44 | /** |
| elijahsj | 1:8a094db1347f | 45 | * \defgroup hal_gpioirq GPIO IRQ HAL functions |
| elijahsj | 1:8a094db1347f | 46 | * @{ |
| elijahsj | 1:8a094db1347f | 47 | */ |
| elijahsj | 1:8a094db1347f | 48 | |
| elijahsj | 1:8a094db1347f | 49 | /** Initialize the GPIO IRQ pin |
| elijahsj | 1:8a094db1347f | 50 | * |
| elijahsj | 1:8a094db1347f | 51 | * @param obj The GPIO object to initialize |
| elijahsj | 1:8a094db1347f | 52 | * @param pin The GPIO pin name |
| elijahsj | 1:8a094db1347f | 53 | * @param handler The handler to be attached to GPIO IRQ |
| elijahsj | 1:8a094db1347f | 54 | * @param id The object ID (id != 0, 0 is reserved) |
| elijahsj | 1:8a094db1347f | 55 | * @return -1 if pin is NC, 0 otherwise |
| elijahsj | 1:8a094db1347f | 56 | */ |
| elijahsj | 1:8a094db1347f | 57 | int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id); |
| elijahsj | 1:8a094db1347f | 58 | |
| elijahsj | 1:8a094db1347f | 59 | /** Release the GPIO IRQ PIN |
| elijahsj | 1:8a094db1347f | 60 | * |
| elijahsj | 1:8a094db1347f | 61 | * @param obj The gpio object |
| elijahsj | 1:8a094db1347f | 62 | */ |
| elijahsj | 1:8a094db1347f | 63 | void gpio_irq_free(gpio_irq_t *obj); |
| elijahsj | 1:8a094db1347f | 64 | |
| elijahsj | 1:8a094db1347f | 65 | /** Enable/disable pin IRQ event |
| elijahsj | 1:8a094db1347f | 66 | * |
| elijahsj | 1:8a094db1347f | 67 | * @param obj The GPIO object |
| elijahsj | 1:8a094db1347f | 68 | * @param event The GPIO IRQ event |
| elijahsj | 1:8a094db1347f | 69 | * @param enable The enable flag |
| elijahsj | 1:8a094db1347f | 70 | */ |
| elijahsj | 1:8a094db1347f | 71 | void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable); |
| elijahsj | 1:8a094db1347f | 72 | |
| elijahsj | 1:8a094db1347f | 73 | /** Enable GPIO IRQ |
| elijahsj | 1:8a094db1347f | 74 | * |
| elijahsj | 1:8a094db1347f | 75 | * This is target dependent, as it might enable the entire port or just a pin |
| elijahsj | 1:8a094db1347f | 76 | * @param obj The GPIO object |
| elijahsj | 1:8a094db1347f | 77 | */ |
| elijahsj | 1:8a094db1347f | 78 | void gpio_irq_enable(gpio_irq_t *obj); |
| elijahsj | 1:8a094db1347f | 79 | |
| elijahsj | 1:8a094db1347f | 80 | /** Disable GPIO IRQ |
| elijahsj | 1:8a094db1347f | 81 | * |
| elijahsj | 1:8a094db1347f | 82 | * This is target dependent, as it might disable the entire port or just a pin |
| elijahsj | 1:8a094db1347f | 83 | * @param obj The GPIO object |
| elijahsj | 1:8a094db1347f | 84 | */ |
| elijahsj | 1:8a094db1347f | 85 | void gpio_irq_disable(gpio_irq_t *obj); |
| elijahsj | 1:8a094db1347f | 86 | |
| elijahsj | 1:8a094db1347f | 87 | /**@}*/ |
| elijahsj | 1:8a094db1347f | 88 | |
| elijahsj | 1:8a094db1347f | 89 | #ifdef __cplusplus |
| elijahsj | 1:8a094db1347f | 90 | } |
| elijahsj | 1:8a094db1347f | 91 | #endif |
| elijahsj | 1:8a094db1347f | 92 | |
| elijahsj | 1:8a094db1347f | 93 | #endif |
| elijahsj | 1:8a094db1347f | 94 | |
| elijahsj | 1:8a094db1347f | 95 | #endif |
| elijahsj | 1:8a094db1347f | 96 | |
| elijahsj | 1:8a094db1347f | 97 | /** @}*/ |