mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gpio_irq_api.h Source File

gpio_irq_api.h

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