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