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.
TARGET_DISCO_L475VG_IOT01A/TARGET_STM/TARGET_STM32L4/pin_device.h@145:64910690c574, 2017-06-21 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Jun 21 17:31:38 2017 +0100
- Revision:
- 145:64910690c574
- Child:
- 170:e95d10626187
Release 145 of the mbed library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 145:64910690c574 | 1 | /* mbed Microcontroller Library |
AnnaBridge | 145:64910690c574 | 2 | ******************************************************************************* |
AnnaBridge | 145:64910690c574 | 3 | * Copyright (c) 2016, STMicroelectronics |
AnnaBridge | 145:64910690c574 | 4 | * All rights reserved. |
AnnaBridge | 145:64910690c574 | 5 | * |
AnnaBridge | 145:64910690c574 | 6 | * Redistribution and use in source and binary forms, with or without |
AnnaBridge | 145:64910690c574 | 7 | * modification, are permitted provided that the following conditions are met: |
AnnaBridge | 145:64910690c574 | 8 | * |
AnnaBridge | 145:64910690c574 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
AnnaBridge | 145:64910690c574 | 10 | * this list of conditions and the following disclaimer. |
AnnaBridge | 145:64910690c574 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
AnnaBridge | 145:64910690c574 | 12 | * this list of conditions and the following disclaimer in the documentation |
AnnaBridge | 145:64910690c574 | 13 | * and/or other materials provided with the distribution. |
AnnaBridge | 145:64910690c574 | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
AnnaBridge | 145:64910690c574 | 15 | * may be used to endorse or promote products derived from this software |
AnnaBridge | 145:64910690c574 | 16 | * without specific prior written permission. |
AnnaBridge | 145:64910690c574 | 17 | * |
AnnaBridge | 145:64910690c574 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AnnaBridge | 145:64910690c574 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
AnnaBridge | 145:64910690c574 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 145:64910690c574 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
AnnaBridge | 145:64910690c574 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
AnnaBridge | 145:64910690c574 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
AnnaBridge | 145:64910690c574 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
AnnaBridge | 145:64910690c574 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
AnnaBridge | 145:64910690c574 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
AnnaBridge | 145:64910690c574 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 145:64910690c574 | 28 | ******************************************************************************* |
AnnaBridge | 145:64910690c574 | 29 | */ |
AnnaBridge | 145:64910690c574 | 30 | #ifndef MBED_PIN_DEVICE_H |
AnnaBridge | 145:64910690c574 | 31 | #define MBED_PIN_DEVICE_H |
AnnaBridge | 145:64910690c574 | 32 | |
AnnaBridge | 145:64910690c574 | 33 | #include "cmsis.h" |
AnnaBridge | 145:64910690c574 | 34 | #include "stm32l4xx_ll_gpio.h" |
AnnaBridge | 145:64910690c574 | 35 | |
AnnaBridge | 145:64910690c574 | 36 | extern const uint32_t ll_pin_defines[16]; |
AnnaBridge | 145:64910690c574 | 37 | |
AnnaBridge | 145:64910690c574 | 38 | /* Family specific implementations */ |
AnnaBridge | 145:64910690c574 | 39 | static inline void stm_pin_DisconnectDebug(PinName pin) |
AnnaBridge | 145:64910690c574 | 40 | { |
AnnaBridge | 145:64910690c574 | 41 | /* empty for now */ |
AnnaBridge | 145:64910690c574 | 42 | } |
AnnaBridge | 145:64910690c574 | 43 | |
AnnaBridge | 145:64910690c574 | 44 | static inline void stm_pin_PullConfig(GPIO_TypeDef *gpio, uint32_t ll_pin, uint32_t pull_config) |
AnnaBridge | 145:64910690c574 | 45 | { |
AnnaBridge | 145:64910690c574 | 46 | switch (pull_config) { |
AnnaBridge | 145:64910690c574 | 47 | case GPIO_PULLUP: |
AnnaBridge | 145:64910690c574 | 48 | LL_GPIO_SetPinPull(gpio, ll_pin, LL_GPIO_PULL_UP); |
AnnaBridge | 145:64910690c574 | 49 | break; |
AnnaBridge | 145:64910690c574 | 50 | case GPIO_PULLDOWN: |
AnnaBridge | 145:64910690c574 | 51 | LL_GPIO_SetPinPull(gpio, ll_pin, LL_GPIO_PULL_DOWN); |
AnnaBridge | 145:64910690c574 | 52 | break; |
AnnaBridge | 145:64910690c574 | 53 | default: |
AnnaBridge | 145:64910690c574 | 54 | LL_GPIO_SetPinPull(gpio, ll_pin, LL_GPIO_PULL_NO); |
AnnaBridge | 145:64910690c574 | 55 | break; |
AnnaBridge | 145:64910690c574 | 56 | } |
AnnaBridge | 145:64910690c574 | 57 | } |
AnnaBridge | 145:64910690c574 | 58 | |
AnnaBridge | 145:64910690c574 | 59 | static inline void stm_pin_SetAFPin( GPIO_TypeDef *gpio, PinName pin, uint32_t afnum) |
AnnaBridge | 145:64910690c574 | 60 | { |
AnnaBridge | 145:64910690c574 | 61 | uint32_t ll_pin = ll_pin_defines[STM_PIN(pin)]; |
AnnaBridge | 145:64910690c574 | 62 | |
AnnaBridge | 145:64910690c574 | 63 | if (STM_PIN(pin) > 7) |
AnnaBridge | 145:64910690c574 | 64 | LL_GPIO_SetAFPin_8_15(gpio, ll_pin, afnum); |
AnnaBridge | 145:64910690c574 | 65 | else |
AnnaBridge | 145:64910690c574 | 66 | LL_GPIO_SetAFPin_0_7(gpio, ll_pin, afnum); |
AnnaBridge | 145:64910690c574 | 67 | } |
AnnaBridge | 145:64910690c574 | 68 | |
AnnaBridge | 145:64910690c574 | 69 | #endif |