Mistake on this page?
Report an issue in GitHub or email us
gpio_irq_api.h
1 
2 /** \addtogroup hal */
3 /** @{*/
4 /* mbed Microcontroller Library
5  * Copyright (c) 2006-2013 ARM Limited
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef MBED_GPIO_IRQ_API_H
21 #define MBED_GPIO_IRQ_API_H
22 
23 #include "device.h"
24 
25 #if DEVICE_INTERRUPTIN
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /** GPIO IRQ events
32  */
33 typedef enum {
34  IRQ_NONE,
35  IRQ_RISE,
36  IRQ_FALL
38 
39 /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL
40  */
41 typedef struct gpio_irq_s gpio_irq_t;
42 
43 typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
44 
45 /**
46  * \defgroup hal_gpioirq GPIO IRQ HAL functions
47  * @{
48  */
49 
50 /** Initialize the GPIO IRQ pin
51  *
52  * @param obj The GPIO object to initialize
53  * @param pin The GPIO pin name
54  * @param handler The handler to be attached to GPIO IRQ
55  * @param id The object ID (id != 0, 0 is reserved)
56  * @return -1 if pin is NC, 0 otherwise
57  */
58 int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
59 
60 /** Release the GPIO IRQ PIN
61  *
62  * @param obj The gpio object
63  */
64 void gpio_irq_free(gpio_irq_t *obj);
65 
66 /** Enable/disable pin IRQ event
67  *
68  * @param obj The GPIO object
69  * @param event The GPIO IRQ event
70  * @param enable The enable flag
71  */
72 void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
73 
74 /** Enable GPIO IRQ
75  *
76  * This is target dependent, as it might enable the entire port or just a pin
77  * @param obj The GPIO object
78  */
79 void gpio_irq_enable(gpio_irq_t *obj);
80 
81 /** Disable GPIO IRQ
82  *
83  * This is target dependent, as it might disable the entire port or just a pin
84  * @param obj The GPIO object
85  */
86 void gpio_irq_disable(gpio_irq_t *obj);
87 
88 /**@}*/
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif
95 
96 #endif
97 
98 /** @}*/
void gpio_irq_enable(gpio_irq_t *obj)
Enable GPIO IRQ.
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id)
Initialize the GPIO IRQ pin.
gpio_irq_event
GPIO IRQ events.
Definition: gpio_irq_api.h:33
void gpio_irq_free(gpio_irq_t *obj)
Release the GPIO IRQ PIN.
struct gpio_irq_s gpio_irq_t
GPIO IRQ HAL structure.
Definition: gpio_irq_api.h:41
void gpio_irq_disable(gpio_irq_t *obj)
Disable GPIO IRQ.
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
Enable/disable pin IRQ event.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.