Life is random and unfair!
Fork of mbed-dev by
Embed:
(wiki syntax)
Show/hide line numbers
gpio_irq_api.h
00001 00002 /** \addtogroup hal */ 00003 /** @{*/ 00004 /* mbed Microcontroller Library 00005 * Copyright (c) 2006-2013 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 #ifndef MBED_GPIO_IRQ_API_H 00020 #define MBED_GPIO_IRQ_API_H 00021 00022 #include "device.h" 00023 00024 #if DEVICE_INTERRUPTIN 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /** GPIO IRQ events 00031 */ 00032 typedef enum { 00033 IRQ_NONE, 00034 IRQ_RISE, 00035 IRQ_FALL 00036 } gpio_irq_event; 00037 00038 /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL 00039 */ 00040 typedef struct gpio_irq_s gpio_irq_t; 00041 00042 typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event); 00043 00044 /** 00045 * \defgroup hal_gpioirq GPIO IRQ HAL functions 00046 * @{ 00047 */ 00048 00049 /** Initialize the GPIO IRQ pin 00050 * 00051 * @param obj The GPIO object to initialize 00052 * @param pin The GPIO pin name 00053 * @param handler The handler to be attached to GPIO IRQ 00054 * @param id The object ID (id != 0, 0 is reserved) 00055 * @return -1 if pin is NC, 0 otherwise 00056 */ 00057 int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id); 00058 00059 /** Release the GPIO IRQ PIN 00060 * 00061 * @param obj The gpio object 00062 */ 00063 void gpio_irq_free(gpio_irq_t *obj); 00064 00065 /** Enable/disable pin IRQ event 00066 * 00067 * @param obj The GPIO object 00068 * @param event The GPIO IRQ event 00069 * @param enable The enable flag 00070 */ 00071 void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable); 00072 00073 /** Enable GPIO IRQ 00074 * 00075 * This is target dependent, as it might enable the entire port or just a pin 00076 * @param obj The GPIO object 00077 */ 00078 void gpio_irq_enable(gpio_irq_t *obj); 00079 00080 /** Disable GPIO IRQ 00081 * 00082 * This is target dependent, as it might disable the entire port or just a pin 00083 * @param obj The GPIO object 00084 */ 00085 void gpio_irq_disable(gpio_irq_t *obj); 00086 00087 /**@}*/ 00088 00089 #ifdef __cplusplus 00090 } 00091 #endif 00092 00093 #endif 00094 00095 #endif 00096 00097 /** @}*/
Generated on Tue Jul 12 2022 19:28:24 by 1.7.2