mbed-os

Fork of mbed-os by erkin yucel

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

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