mbed library sources for GR-PEACH rev.B.

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Mar 26 13:45:12 2015 +0000
Revision:
497:d54623194236
Synchronized with git revision 0251fefac99a5b59beb481e845c6fbf48736bac6

Full URL: https://github.com/mbedmicro/mbed/commit/0251fefac99a5b59beb481e845c6fbf48736bac6/

DISCO_F100RB -Support HAL driver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 497:d54623194236 1 /* mbed Microcontroller Library
mbed_official 497:d54623194236 2 *******************************************************************************
mbed_official 497:d54623194236 3 * Copyright (c) 2014, STMicroelectronics
mbed_official 497:d54623194236 4 * All rights reserved.
mbed_official 497:d54623194236 5 *
mbed_official 497:d54623194236 6 * Redistribution and use in source and binary forms, with or without
mbed_official 497:d54623194236 7 * modification, are permitted provided that the following conditions are met:
mbed_official 497:d54623194236 8 *
mbed_official 497:d54623194236 9 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 497:d54623194236 10 * this list of conditions and the following disclaimer.
mbed_official 497:d54623194236 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 497:d54623194236 12 * this list of conditions and the following disclaimer in the documentation
mbed_official 497:d54623194236 13 * and/or other materials provided with the distribution.
mbed_official 497:d54623194236 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 497:d54623194236 15 * may be used to endorse or promote products derived from this software
mbed_official 497:d54623194236 16 * without specific prior written permission.
mbed_official 497:d54623194236 17 *
mbed_official 497:d54623194236 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 497:d54623194236 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 497:d54623194236 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 497:d54623194236 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 497:d54623194236 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 497:d54623194236 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 497:d54623194236 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 497:d54623194236 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 497:d54623194236 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 497:d54623194236 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 497:d54623194236 28 *******************************************************************************
mbed_official 497:d54623194236 29 */
mbed_official 497:d54623194236 30
mbed_official 497:d54623194236 31 #include "PeripheralPins.h"
mbed_official 497:d54623194236 32
mbed_official 497:d54623194236 33 // =====
mbed_official 497:d54623194236 34 // Note: Commented lines are alternative possibilities which are not used per default.
mbed_official 497:d54623194236 35 // If you change them, you will have also to modify the corresponding xxx_api.c file
mbed_official 497:d54623194236 36 // for pwmout, analogin, analogout, ...
mbed_official 497:d54623194236 37 // =====
mbed_official 497:d54623194236 38
mbed_official 497:d54623194236 39 //*** ADC ***
mbed_official 497:d54623194236 40
mbed_official 497:d54623194236 41 const PinMap PinMap_ADC[] = {
mbed_official 497:d54623194236 42 {PA_0, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN0
mbed_official 497:d54623194236 43 {PA_1, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN1
mbed_official 497:d54623194236 44 {PA_2, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN2
mbed_official 497:d54623194236 45 {PA_3, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN3
mbed_official 497:d54623194236 46 {PA_4, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN4
mbed_official 497:d54623194236 47 {PA_5, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN5
mbed_official 497:d54623194236 48 {PA_6, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN6
mbed_official 497:d54623194236 49 {PA_7, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN7
mbed_official 497:d54623194236 50 {PB_0, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN8
mbed_official 497:d54623194236 51 {PB_1, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN9
mbed_official 497:d54623194236 52 {PC_0, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN10
mbed_official 497:d54623194236 53 {PC_1, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN11
mbed_official 497:d54623194236 54 {PC_2, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN12
mbed_official 497:d54623194236 55 {PC_3, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN13
mbed_official 497:d54623194236 56 {PC_4, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN14
mbed_official 497:d54623194236 57 {PC_5, ADC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // ADC12_IN15
mbed_official 497:d54623194236 58 {NC, NC, 0}
mbed_official 497:d54623194236 59 };
mbed_official 497:d54623194236 60
mbed_official 497:d54623194236 61 //*** I2C ***
mbed_official 497:d54623194236 62
mbed_official 497:d54623194236 63 const PinMap PinMap_I2C_SDA[] = {
mbed_official 497:d54623194236 64 {PB_7, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 65 {PB_9, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 2)}, // GPIO_Remap_I2C1
mbed_official 497:d54623194236 66 {PB_11, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 67 {NC, NC, 0}
mbed_official 497:d54623194236 68 };
mbed_official 497:d54623194236 69
mbed_official 497:d54623194236 70 const PinMap PinMap_I2C_SCL[] = {
mbed_official 497:d54623194236 71 {PB_6, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 72 {PB_8, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 2)}, // GPIO_Remap_I2C1
mbed_official 497:d54623194236 73 {PB_10, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 74 {NC, NC, 0}
mbed_official 497:d54623194236 75 };
mbed_official 497:d54623194236 76
mbed_official 497:d54623194236 77 //*** PWM ***
mbed_official 497:d54623194236 78
mbed_official 497:d54623194236 79 // TIM4 cannot be used because already used by the us_ticker
mbed_official 497:d54623194236 80 const PinMap PinMap_PWM[] = {
mbed_official 497:d54623194236 81 {PA_1, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM2_CH2 - Default
mbed_official 497:d54623194236 82 {PA_2, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM2_CH3 - Default (warning: not connected on D1 per default)
mbed_official 497:d54623194236 83 {PA_3, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM2_CH4 - Default (warning: not connected on D0 per default)
mbed_official 497:d54623194236 84 {PA_6, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM3_CH1 - Default
mbed_official 497:d54623194236 85 {PA_7, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM3_CH2 - Default
mbed_official 497:d54623194236 86 // {PA_7, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 6)}, // TIM1_CH1N - GPIO_PartialRemap_TIM1
mbed_official 497:d54623194236 87 {PA_8, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH1 - Default
mbed_official 497:d54623194236 88 {PA_9, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH2 - Default
mbed_official 497:d54623194236 89 {PA_10, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH3 - Default
mbed_official 497:d54623194236 90 {PA_11, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH4 - Default
mbed_official 497:d54623194236 91 {PA_15, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 8)}, // TIM2_CH1_ETR - GPIO_FullRemap_TIM2
mbed_official 497:d54623194236 92
mbed_official 497:d54623194236 93 {PB_0, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM3_CH3 - Default
mbed_official 497:d54623194236 94 // {PB_0, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 6)}, // TIM1_CH2N - GPIO_PartialRemap_TIM1
mbed_official 497:d54623194236 95 {PB_1, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM3_CH4 - Default
mbed_official 497:d54623194236 96 // {PB_1, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 6)}, // TIM1_CH3N - GPIO_PartialRemap_TIM1
mbed_official 497:d54623194236 97 {PB_3, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 8)}, // TIM2_CH2 - GPIO_FullRemap_TIM2
mbed_official 497:d54623194236 98 {PB_4, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 7)}, // TIM3_CH1 - GPIO_PartialRemap_TIM3
mbed_official 497:d54623194236 99 {PB_5, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 7)}, // TIM3_CH2 - GPIO_PartialRemap_TIM3
mbed_official 497:d54623194236 100 // {PB_6, PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM4_CH1 - Default (used by ticker)
mbed_official 497:d54623194236 101 // {PB_7, PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM4_CH2 - Default (used by ticker)
mbed_official 497:d54623194236 102 // {PB_8, PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM4_CH3 - Default (used by ticker)
mbed_official 497:d54623194236 103 // {PB_9, PWM_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM4_CH4 - Default (used by ticker)
mbed_official 497:d54623194236 104 {PB_10, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 8)}, // TIM2_CH3 - GPIO_FullRemap_TIM2
mbed_official 497:d54623194236 105 {PB_11, PWM_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 8)}, // TIM2_CH4 - GPIO_FullRemap_TIM2
mbed_official 497:d54623194236 106 {PB_13, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH1N - Default
mbed_official 497:d54623194236 107 {PB_14, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH2N - Default
mbed_official 497:d54623194236 108 {PB_15, PWM_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)}, // TIM1_CH3N - Default
mbed_official 497:d54623194236 109
mbed_official 497:d54623194236 110 {PC_6, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 9)}, // TIM3_CH1 - GPIO_FullRemap_TIM3
mbed_official 497:d54623194236 111 {PC_7, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 9)}, // TIM3_CH2 - GPIO_FullRemap_TIM3
mbed_official 497:d54623194236 112 {PC_8, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 9)}, // TIM3_CH3 - GPIO_FullRemap_TIM3
mbed_official 497:d54623194236 113 {PC_9, PWM_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 9)}, // TIM3_CH4 - GPIO_FullRemap_TIM3
mbed_official 497:d54623194236 114 {NC, NC, 0}
mbed_official 497:d54623194236 115 };
mbed_official 497:d54623194236 116
mbed_official 497:d54623194236 117 //*** SERIAL ***
mbed_official 497:d54623194236 118
mbed_official 497:d54623194236 119 const PinMap PinMap_UART_TX[] = {
mbed_official 497:d54623194236 120 {PA_2, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
mbed_official 497:d54623194236 121 {PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
mbed_official 497:d54623194236 122 {PB_6, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 3)}, // GPIO_Remap_USART1
mbed_official 497:d54623194236 123 {PB_10, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 0)},
mbed_official 497:d54623194236 124 {PC_10, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, 5)}, // GPIO_PartialRemap_USART3
mbed_official 497:d54623194236 125 {NC, NC, 0}
mbed_official 497:d54623194236 126 };
mbed_official 497:d54623194236 127
mbed_official 497:d54623194236 128 const PinMap PinMap_UART_RX[] = {
mbed_official 497:d54623194236 129 {PA_3, UART_2, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, 0)},
mbed_official 497:d54623194236 130 {PA_10, UART_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, 0)},
mbed_official 497:d54623194236 131 {PB_7, UART_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, 3)}, // GPIO_Remap_USART1
mbed_official 497:d54623194236 132 {PB_11, UART_3, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, 0)},
mbed_official 497:d54623194236 133 {PC_11, UART_3, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, 5)}, // GPIO_PartialRemap_USART3
mbed_official 497:d54623194236 134 {NC, NC, 0}
mbed_official 497:d54623194236 135 };
mbed_official 497:d54623194236 136
mbed_official 497:d54623194236 137 //*** SPI ***
mbed_official 497:d54623194236 138
mbed_official 497:d54623194236 139 const PinMap PinMap_SPI_MOSI[] = {
mbed_official 497:d54623194236 140 {PA_7, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 141 {PB_5, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)}, // GPIO_Remap_SPI1
mbed_official 497:d54623194236 142 {PB_15, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 143 {NC, NC, 0}
mbed_official 497:d54623194236 144 };
mbed_official 497:d54623194236 145
mbed_official 497:d54623194236 146 const PinMap PinMap_SPI_MISO[] = {
mbed_official 497:d54623194236 147 {PA_6, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 148 {PB_4, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)}, // GPIO_Remap_SPI1
mbed_official 497:d54623194236 149 {PB_14, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 150 {NC, NC, 0}
mbed_official 497:d54623194236 151 };
mbed_official 497:d54623194236 152
mbed_official 497:d54623194236 153 const PinMap PinMap_SPI_SCLK[] = {
mbed_official 497:d54623194236 154 {PA_5, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 155 {PB_3, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)}, // GPIO_Remap_SPI1
mbed_official 497:d54623194236 156 {PB_13, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 157 {NC, NC, 0}
mbed_official 497:d54623194236 158 };
mbed_official 497:d54623194236 159
mbed_official 497:d54623194236 160 const PinMap PinMap_SPI_SSEL[] = {
mbed_official 497:d54623194236 161 {PA_4, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 162 {PA_15, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)}, // GPIO_Remap_SPI1
mbed_official 497:d54623194236 163 {PB_12, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
mbed_official 497:d54623194236 164 {NC, NC, 0}
mbed_official 497:d54623194236 165 };