mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_STM/TARGET_STM32F2/gpio_irq_device.h@160:d5399cc887bb, 2017-03-14 (annotated)
- Committer:
- <>
- Date:
- Tue Mar 14 16:40:56 2017 +0000
- Revision:
- 160:d5399cc887bb
- Child:
- 187:0387e8f68319
This updates the lib to the mbed lib v138
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 160:d5399cc887bb | 1 | /* mbed Microcontroller Library |
<> | 160:d5399cc887bb | 2 | ******************************************************************************* |
<> | 160:d5399cc887bb | 3 | * Copyright (c) 2017, STMicroelectronics |
<> | 160:d5399cc887bb | 4 | * All rights reserved. |
<> | 160:d5399cc887bb | 5 | * |
<> | 160:d5399cc887bb | 6 | * Redistribution and use in source and binary forms, with or without |
<> | 160:d5399cc887bb | 7 | * modification, are permitted provided that the following conditions are met: |
<> | 160:d5399cc887bb | 8 | * |
<> | 160:d5399cc887bb | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
<> | 160:d5399cc887bb | 10 | * this list of conditions and the following disclaimer. |
<> | 160:d5399cc887bb | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
<> | 160:d5399cc887bb | 12 | * this list of conditions and the following disclaimer in the documentation |
<> | 160:d5399cc887bb | 13 | * and/or other materials provided with the distribution. |
<> | 160:d5399cc887bb | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
<> | 160:d5399cc887bb | 15 | * may be used to endorse or promote products derived from this software |
<> | 160:d5399cc887bb | 16 | * without specific prior written permission. |
<> | 160:d5399cc887bb | 17 | * |
<> | 160:d5399cc887bb | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 160:d5399cc887bb | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 160:d5399cc887bb | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 160:d5399cc887bb | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 160:d5399cc887bb | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 160:d5399cc887bb | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 160:d5399cc887bb | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 160:d5399cc887bb | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 160:d5399cc887bb | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 160:d5399cc887bb | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 160:d5399cc887bb | 28 | ******************************************************************************* |
<> | 160:d5399cc887bb | 29 | */ |
<> | 160:d5399cc887bb | 30 | #ifndef MBED_GPIO_IRQ_DEVICE_H |
<> | 160:d5399cc887bb | 31 | #define MBED_GPIO_IRQ_DEVICE_H |
<> | 160:d5399cc887bb | 32 | |
<> | 160:d5399cc887bb | 33 | #ifdef __cplusplus |
<> | 160:d5399cc887bb | 34 | extern "C" { |
<> | 160:d5399cc887bb | 35 | #endif |
<> | 160:d5399cc887bb | 36 | |
<> | 160:d5399cc887bb | 37 | // when LL is available, below include can be used |
<> | 160:d5399cc887bb | 38 | // #include "stm32f2xx_ll_exti.h" |
<> | 160:d5399cc887bb | 39 | // until then let's define locally the required functions |
<> | 160:d5399cc887bb | 40 | __STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine) |
<> | 160:d5399cc887bb | 41 | { |
<> | 160:d5399cc887bb | 42 | SET_BIT(EXTI->RTSR, ExtiLine); |
<> | 160:d5399cc887bb | 43 | } |
<> | 160:d5399cc887bb | 44 | __STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine) |
<> | 160:d5399cc887bb | 45 | { |
<> | 160:d5399cc887bb | 46 | CLEAR_BIT(EXTI->RTSR, ExtiLine); |
<> | 160:d5399cc887bb | 47 | } |
<> | 160:d5399cc887bb | 48 | __STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine) |
<> | 160:d5399cc887bb | 49 | { |
<> | 160:d5399cc887bb | 50 | SET_BIT(EXTI->FTSR, ExtiLine); |
<> | 160:d5399cc887bb | 51 | } |
<> | 160:d5399cc887bb | 52 | __STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine) |
<> | 160:d5399cc887bb | 53 | { |
<> | 160:d5399cc887bb | 54 | CLEAR_BIT(EXTI->FTSR, ExtiLine); |
<> | 160:d5399cc887bb | 55 | } |
<> | 160:d5399cc887bb | 56 | __STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine) |
<> | 160:d5399cc887bb | 57 | { |
<> | 160:d5399cc887bb | 58 | SET_BIT(EXTI->IMR, ExtiLine); |
<> | 160:d5399cc887bb | 59 | } |
<> | 160:d5399cc887bb | 60 | __STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine) |
<> | 160:d5399cc887bb | 61 | { |
<> | 160:d5399cc887bb | 62 | CLEAR_BIT(EXTI->IMR, ExtiLine); |
<> | 160:d5399cc887bb | 63 | } |
<> | 160:d5399cc887bb | 64 | // Above lines shall be later defined in LL |
<> | 160:d5399cc887bb | 65 | |
<> | 160:d5399cc887bb | 66 | // Number of EXTI irq vectors (EXTI0, EXTI1, EXTI2, EXTI3, EXTI4, EXTI5_9, EXTI10_15) |
<> | 160:d5399cc887bb | 67 | #define CHANNEL_NUM (7) |
<> | 160:d5399cc887bb | 68 | |
<> | 160:d5399cc887bb | 69 | #define EXTI_IRQ0_NUM_LINES 1 |
<> | 160:d5399cc887bb | 70 | #define EXTI_IRQ1_NUM_LINES 1 |
<> | 160:d5399cc887bb | 71 | #define EXTI_IRQ2_NUM_LINES 1 |
<> | 160:d5399cc887bb | 72 | #define EXTI_IRQ3_NUM_LINES 1 |
<> | 160:d5399cc887bb | 73 | #define EXTI_IRQ4_NUM_LINES 1 |
<> | 160:d5399cc887bb | 74 | #define EXTI_IRQ5_NUM_LINES 5 |
<> | 160:d5399cc887bb | 75 | #define EXTI_IRQ6_NUM_LINES 6 |
<> | 160:d5399cc887bb | 76 | |
<> | 160:d5399cc887bb | 77 | // Max pins for one line (max with EXTI10_15) |
<> | 160:d5399cc887bb | 78 | #define MAX_PIN_LINE (EXTI_IRQ6_NUM_LINES) |
<> | 160:d5399cc887bb | 79 | |
<> | 160:d5399cc887bb | 80 | /* Structure to describe how the HW EXTI lines are defined in this HW */ |
<> | 160:d5399cc887bb | 81 | typedef struct exti_lines { |
<> | 160:d5399cc887bb | 82 | uint32_t gpio_idx; // an index entry for each EXIT line |
<> | 160:d5399cc887bb | 83 | uint32_t irq_index; // the IRQ index |
<> | 160:d5399cc887bb | 84 | IRQn_Type irq_n; // the corresponding EXTI IRQn |
<> | 160:d5399cc887bb | 85 | } exti_lines_t; |
<> | 160:d5399cc887bb | 86 | |
<> | 160:d5399cc887bb | 87 | // Used to return the index for channels array. |
<> | 160:d5399cc887bb | 88 | extern const exti_lines_t pin_lines_desc[]; |
<> | 160:d5399cc887bb | 89 | |
<> | 160:d5399cc887bb | 90 | #ifdef __cplusplus |
<> | 160:d5399cc887bb | 91 | } |
<> | 160:d5399cc887bb | 92 | #endif |
<> | 160:d5399cc887bb | 93 | |
<> | 160:d5399cc887bb | 94 | #endif |