The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Anna Bridge
Date:
Fri Apr 20 11:08:29 2018 +0100
Revision:
166:5aab5a7997ee
Parent:
146:22da6e220af6
Child:
170:e95d10626187
Updating mbed 2 version number

Who changed what in which revision?

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