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