guiguitant théo / greenhouse1

Dependencies:   mbed

Committer:
guiguitt
Date:
Thu Mar 28 09:26:33 2019 +0000
Revision:
0:3fc4a1072bca
programme LoRaWan

Who changed what in which revision?

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