mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Oct 25 14:53:38 2017 +0100
Revision:
176:447f873cad2f
Parent:
163:74e0ce7f98e8
Child:
181:57724642e740
This updates the lib to the mbed lib v 154

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /* mbed Microcontroller Library
<> 149:156823d33999 2 *******************************************************************************
AnnaBridge 176:447f873cad2f 3 * Copyright (c) 2017, STMicroelectronics
<> 149:156823d33999 4 * All rights reserved.
<> 149:156823d33999 5 *
<> 149:156823d33999 6 * Redistribution and use in source and binary forms, with or without
<> 149:156823d33999 7 * modification, are permitted provided that the following conditions are met:
<> 149:156823d33999 8 *
<> 149:156823d33999 9 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 10 * this list of conditions and the following disclaimer.
<> 149:156823d33999 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 12 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 13 * and/or other materials provided with the distribution.
<> 149:156823d33999 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 15 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 16 * without specific prior written permission.
<> 149:156823d33999 17 *
<> 149:156823d33999 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 28 *******************************************************************************
<> 149:156823d33999 29 */
<> 149:156823d33999 30
<> 149:156823d33999 31 #include "PeripheralPins.h"
<> 149:156823d33999 32
AnnaBridge 176:447f873cad2f 33 //==============================================================================
AnnaBridge 176:447f873cad2f 34 // Notes
AnnaBridge 176:447f873cad2f 35 //
AnnaBridge 176:447f873cad2f 36 // - The pins mentionned Px_y_ALTz are alternative possibilities which use other
AnnaBridge 176:447f873cad2f 37 // HW peripheral instances. You can use them the same way as any other "normal"
AnnaBridge 176:447f873cad2f 38 // pin (i.e. PwmOut pwm(PA_7_ALT0);). These pins are not displayed on the board
AnnaBridge 176:447f873cad2f 39 // pinout image on mbed.org.
AnnaBridge 176:447f873cad2f 40 //
AnnaBridge 176:447f873cad2f 41 // - The pins which are connected to other components present on the board have
AnnaBridge 176:447f873cad2f 42 // the comment "Connected to xxx". The pin function may not work properly in this
AnnaBridge 176:447f873cad2f 43 // case. These pins may not be displayed on the board pinout image on mbed.org.
AnnaBridge 176:447f873cad2f 44 // Please read the board reference manual and schematic for more information.
AnnaBridge 176:447f873cad2f 45 //
AnnaBridge 176:447f873cad2f 46 //==============================================================================
<> 149:156823d33999 47
<> 149:156823d33999 48 //*** ADC ***
<> 149:156823d33999 49
<> 149:156823d33999 50 const PinMap PinMap_ADC[] = {
<> 149:156823d33999 51 {PA_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
<> 149:156823d33999 52 {PA_1, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
AnnaBridge 176:447f873cad2f 53 // {PA_2, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 - Connected to STDIO_UART_TX
<> 149:156823d33999 54 {PA_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
<> 149:156823d33999 55 {PA_4, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
<> 149:156823d33999 56 {PA_5, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
<> 149:156823d33999 57 {PA_6, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11
<> 149:156823d33999 58 {PA_7, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12
<> 149:156823d33999 59 {PB_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15
<> 149:156823d33999 60 // {PB_1, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_IN16 - does not support channel >= 16
Anna Bridge 163:74e0ce7f98e8 61 {NC, NC, 0}
Anna Bridge 163:74e0ce7f98e8 62 };
Anna Bridge 163:74e0ce7f98e8 63
Anna Bridge 163:74e0ce7f98e8 64 const PinMap PinMap_ADC_Internal[] = {
<> 149:156823d33999 65 {ADC_TEMP, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)},
<> 149:156823d33999 66 {ADC_VREF, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)},
<> 149:156823d33999 67 {ADC_VBAT, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)},
<> 149:156823d33999 68 {NC, NC, 0}
<> 149:156823d33999 69 };
<> 149:156823d33999 70
<> 149:156823d33999 71 //*** DAC ***
<> 149:156823d33999 72
<> 149:156823d33999 73 const PinMap PinMap_DAC[] = {
<> 149:156823d33999 74 {PA_4, DAC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1
<> 149:156823d33999 75 {PA_5, DAC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2
<> 149:156823d33999 76 {NC, NC, 0}
<> 149:156823d33999 77 };
<> 149:156823d33999 78
<> 149:156823d33999 79 //*** I2C ***
<> 149:156823d33999 80
<> 149:156823d33999 81 const PinMap PinMap_I2C_SDA[] = {
<> 149:156823d33999 82 {PA_10, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
<> 149:156823d33999 83 {PB_4, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
<> 149:156823d33999 84 {PB_7, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
<> 149:156823d33999 85 {NC, NC, 0}
<> 149:156823d33999 86 };
<> 149:156823d33999 87
<> 149:156823d33999 88 const PinMap PinMap_I2C_SCL[] = {
<> 149:156823d33999 89 {PA_7, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
<> 149:156823d33999 90 {PA_9, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
<> 149:156823d33999 91 {PB_6, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
<> 149:156823d33999 92 {NC, NC, 0}
<> 149:156823d33999 93 };
<> 149:156823d33999 94
<> 149:156823d33999 95 //*** PWM ***
<> 149:156823d33999 96
AnnaBridge 176:447f873cad2f 97 // TIM2 (PWM_2) cannot be used because already used by the us_ticker
<> 149:156823d33999 98 const PinMap PinMap_PWM[] = {
<> 149:156823d33999 99 // {PA_0, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
<> 149:156823d33999 100 {PA_1, PWM_15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 1, 1)}, // TIM15_CH1N
<> 149:156823d33999 101 // {PA_1, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
AnnaBridge 176:447f873cad2f 102 // {PA_2, PWM_15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 1, 0)}, // TIM15_CH1 - Connected to STDIO_UART_TX
AnnaBridge 176:447f873cad2f 103 // {PA_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 - Connected to STDIO_UART_TX
<> 149:156823d33999 104 {PA_3, PWM_15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 2, 0)}, // TIM15_CH2
<> 149:156823d33999 105 // {PA_3, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
<> 149:156823d33999 106 // {PA_5, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
<> 149:156823d33999 107 {PA_6, PWM_16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM16, 1, 0)}, // TIM16_CH1
<> 149:156823d33999 108 {PA_7, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
<> 149:156823d33999 109 {PA_8, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
<> 149:156823d33999 110 {PA_9, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
<> 149:156823d33999 111 {PA_10, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
<> 149:156823d33999 112 {PA_11, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
<> 149:156823d33999 113 {PB_0, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
<> 149:156823d33999 114 {PB_1, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
AnnaBridge 176:447f873cad2f 115 // {PB_3, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 - Connected to LED
<> 149:156823d33999 116 {PB_6, PWM_16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM16, 1, 1)}, // TIM16_CH1N
<> 149:156823d33999 117 {NC, NC, 0}
<> 149:156823d33999 118 };
<> 149:156823d33999 119
<> 149:156823d33999 120 //*** SERIAL ***
<> 149:156823d33999 121
<> 149:156823d33999 122 const PinMap PinMap_UART_TX[] = {
AnnaBridge 176:447f873cad2f 123 {PA_2, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, // Connected to STDIO_UART_TX
AnnaBridge 176:447f873cad2f 124 {PA_2_ALT0, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, // Connected to STDIO_UART_TX
AnnaBridge 176:447f873cad2f 125 {PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
AnnaBridge 176:447f873cad2f 126 {PB_6, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
AnnaBridge 176:447f873cad2f 127 {NC, NC, 0}
<> 149:156823d33999 128 };
<> 149:156823d33999 129
<> 149:156823d33999 130 const PinMap PinMap_UART_RX[] = {
AnnaBridge 176:447f873cad2f 131 {PA_3, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
AnnaBridge 176:447f873cad2f 132 {PA_3_ALT0, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
AnnaBridge 176:447f873cad2f 133 {PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
AnnaBridge 176:447f873cad2f 134 {PA_15, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART2)}, // Connected to STDIO_UART_RX
AnnaBridge 176:447f873cad2f 135 {PB_7, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
AnnaBridge 176:447f873cad2f 136 {NC, NC, 0}
<> 149:156823d33999 137 };
<> 149:156823d33999 138
<> 149:156823d33999 139 const PinMap PinMap_UART_RTS[] = {
<> 149:156823d33999 140 {PA_1, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
<> 149:156823d33999 141 {PA_12, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
<> 149:156823d33999 142 {PB_1, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
AnnaBridge 176:447f873cad2f 143 {PB_3, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, // Connected to LED
<> 149:156823d33999 144 {NC, NC, 0}
<> 149:156823d33999 145 };
<> 149:156823d33999 146
<> 149:156823d33999 147 const PinMap PinMap_UART_CTS[] = {
<> 149:156823d33999 148 {PA_0, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
<> 149:156823d33999 149 {PA_6, LPUART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)},
<> 149:156823d33999 150 {PA_11, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
<> 149:156823d33999 151 {PB_4, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
<> 149:156823d33999 152 {NC, NC, 0}
<> 149:156823d33999 153 };
<> 149:156823d33999 154
<> 149:156823d33999 155 //*** SPI ***
<> 149:156823d33999 156
<> 149:156823d33999 157 const PinMap PinMap_SPI_MOSI[] = {
AnnaBridge 176:447f873cad2f 158 {PA_7, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 159 {PA_12, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 160 {PB_5, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
AnnaBridge 176:447f873cad2f 161 {PB_5_ALT0, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 162 {NC, NC, 0}
<> 149:156823d33999 163 };
<> 149:156823d33999 164
<> 149:156823d33999 165 const PinMap PinMap_SPI_MISO[] = {
AnnaBridge 176:447f873cad2f 166 {PA_6, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 167 {PA_11, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 168 {PB_4, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
AnnaBridge 176:447f873cad2f 169 {PB_4_ALT0, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 170 {NC, NC, 0}
<> 149:156823d33999 171 };
<> 149:156823d33999 172
<> 149:156823d33999 173 const PinMap PinMap_SPI_SCLK[] = {
AnnaBridge 176:447f873cad2f 174 {PA_1, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 175 {PA_5, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 176 {PB_3, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, // Connected to LED
AnnaBridge 176:447f873cad2f 177 {PB_3_ALT0, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, // Connected to LED
AnnaBridge 176:447f873cad2f 178 {NC, NC, 0}
<> 149:156823d33999 179 };
<> 149:156823d33999 180
<> 149:156823d33999 181 const PinMap PinMap_SPI_SSEL[] = {
AnnaBridge 176:447f873cad2f 182 {PA_4, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
AnnaBridge 176:447f873cad2f 183 {PA_4_ALT0, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 184 {PB_0, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
AnnaBridge 176:447f873cad2f 185 {NC, NC, 0}
<> 149:156823d33999 186 };
<> 149:156823d33999 187
<> 149:156823d33999 188 //*** CAN ***
<> 149:156823d33999 189
<> 149:156823d33999 190 const PinMap PinMap_CAN_RD[] = {
<> 149:156823d33999 191 {PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_CAN1)},
<> 149:156823d33999 192 {NC, NC, 0}
<> 149:156823d33999 193 };
<> 149:156823d33999 194
<> 149:156823d33999 195 const PinMap PinMap_CAN_TD[] = {
<> 149:156823d33999 196 {PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_CAN1)},
<> 149:156823d33999 197 {NC, NC, 0}
<> 149:156823d33999 198 };