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 #include "pinmap.h"
25 
26 #if DEVICE_INTERRUPTIN
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /** GPIO IRQ events
33  */
34 typedef enum {
35  IRQ_NONE,
36  IRQ_RISE,
37  IRQ_FALL
39 
40 /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL
41  */
42 typedef struct gpio_irq_s gpio_irq_t;
43 
44 typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
45 
46 /**
47  * \defgroup hal_gpioirq GPIO IRQ HAL functions
48  * @{
49  */
50 
51 /** Initialize the GPIO IRQ pin
52  *
53  * @param obj The GPIO object to initialize
54  * @param pin The GPIO pin name
55  * @param handler The handler to be attached to GPIO IRQ
56  * @param id The object ID (id != 0, 0 is reserved)
57  * @return -1 if pin is NC, 0 otherwise
58  */
59 int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
60 
61 /** Release the GPIO IRQ PIN
62  *
63  * @param obj The gpio object
64  */
65 void gpio_irq_free(gpio_irq_t *obj);
66 
67 /** Enable/disable pin IRQ event
68  *
69  * @param obj The GPIO object
70  * @param event The GPIO IRQ event
71  * @param enable The enable flag
72  */
73 void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
74 
75 /** Enable GPIO IRQ
76  *
77  * This is target dependent, as it might enable the entire port or just a pin
78  * @param obj The GPIO object
79  */
80 void gpio_irq_enable(gpio_irq_t *obj);
81 
82 /** Disable GPIO IRQ
83  *
84  * This is target dependent, as it might disable the entire port or just a pin
85  * @param obj The GPIO object
86  */
87 void gpio_irq_disable(gpio_irq_t *obj);
88 
89 /** Get the pins that support all GPIO IRQ tests
90  *
91  * Return a PinMap array of pins that support GPIO IRQ.
92  * The array is terminated with {NC, NC, 0}.
93  *
94  * Targets should override the weak implementation of this
95  * function to provide the actual pinmap for GPIO IRQ testing.
96  *
97  * @return PinMap array
98  */
99 const PinMap *gpio_irq_pinmap(void);
100 
101 /**@}*/
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif
108 
109 #endif
110 
111 /** @}*/
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:34
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:42
const PinMap * gpio_irq_pinmap(void)
Get the pins that support all GPIO IRQ tests.
void gpio_irq_disable(gpio_irq_t *obj)
Disable GPIO IRQ.
Definition: pinmap.h:31
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.