mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/PinNames.h@323:9e901b0a5aa1, 2014-09-13 (annotated)
- Committer:
- shaoziyang
- Date:
- Sat Sep 13 14:25:46 2014 +0000
- Revision:
- 323:9e901b0a5aa1
- Parent:
- 219:993c9b0acbcc
test with CLOCK_SETUP = 0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 219:993c9b0acbcc | 1 | /* mbed Microcontroller Library |
mbed_official | 219:993c9b0acbcc | 2 | ******************************************************************************* |
mbed_official | 219:993c9b0acbcc | 3 | * Copyright (c) 2014, STMicroelectronics |
mbed_official | 219:993c9b0acbcc | 4 | * All rights reserved. |
mbed_official | 219:993c9b0acbcc | 5 | * |
mbed_official | 219:993c9b0acbcc | 6 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 219:993c9b0acbcc | 7 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 219:993c9b0acbcc | 8 | * |
mbed_official | 219:993c9b0acbcc | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 219:993c9b0acbcc | 10 | * this list of conditions and the following disclaimer. |
mbed_official | 219:993c9b0acbcc | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 219:993c9b0acbcc | 12 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 219:993c9b0acbcc | 13 | * and/or other materials provided with the distribution. |
mbed_official | 219:993c9b0acbcc | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 219:993c9b0acbcc | 15 | * may be used to endorse or promote products derived from this software |
mbed_official | 219:993c9b0acbcc | 16 | * without specific prior written permission. |
mbed_official | 219:993c9b0acbcc | 17 | * |
mbed_official | 219:993c9b0acbcc | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 219:993c9b0acbcc | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 219:993c9b0acbcc | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 219:993c9b0acbcc | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 219:993c9b0acbcc | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 219:993c9b0acbcc | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 219:993c9b0acbcc | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 219:993c9b0acbcc | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 219:993c9b0acbcc | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 219:993c9b0acbcc | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 219:993c9b0acbcc | 28 | ******************************************************************************* |
mbed_official | 219:993c9b0acbcc | 29 | */ |
mbed_official | 219:993c9b0acbcc | 30 | #ifndef MBED_PINNAMES_H |
mbed_official | 219:993c9b0acbcc | 31 | #define MBED_PINNAMES_H |
mbed_official | 219:993c9b0acbcc | 32 | |
mbed_official | 219:993c9b0acbcc | 33 | #include "cmsis.h" |
mbed_official | 219:993c9b0acbcc | 34 | |
mbed_official | 219:993c9b0acbcc | 35 | #ifdef __cplusplus |
mbed_official | 219:993c9b0acbcc | 36 | extern "C" { |
mbed_official | 219:993c9b0acbcc | 37 | #endif |
mbed_official | 219:993c9b0acbcc | 38 | |
mbed_official | 219:993c9b0acbcc | 39 | #define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0))) |
mbed_official | 219:993c9b0acbcc | 40 | |
mbed_official | 219:993c9b0acbcc | 41 | #define STM_PIN_MODE(X) (((X) >> 0) & 0x0F) |
mbed_official | 219:993c9b0acbcc | 42 | #define STM_PIN_PUPD(X) (((X) >> 4) & 0x07) |
mbed_official | 219:993c9b0acbcc | 43 | #define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F) |
mbed_official | 219:993c9b0acbcc | 44 | |
mbed_official | 219:993c9b0acbcc | 45 | #define STM_MODE_INPUT (0) |
mbed_official | 219:993c9b0acbcc | 46 | #define STM_MODE_OUTPUT_PP (1) |
mbed_official | 219:993c9b0acbcc | 47 | #define STM_MODE_OUTPUT_OD (2) |
mbed_official | 219:993c9b0acbcc | 48 | #define STM_MODE_AF_PP (3) |
mbed_official | 219:993c9b0acbcc | 49 | #define STM_MODE_AF_OD (4) |
mbed_official | 219:993c9b0acbcc | 50 | #define STM_MODE_ANALOG (5) |
mbed_official | 219:993c9b0acbcc | 51 | #define STM_MODE_IT_RISING (6) |
mbed_official | 219:993c9b0acbcc | 52 | #define STM_MODE_IT_FALLING (7) |
mbed_official | 219:993c9b0acbcc | 53 | #define STM_MODE_IT_RISING_FALLING (8) |
mbed_official | 219:993c9b0acbcc | 54 | #define STM_MODE_EVT_RISING (9) |
mbed_official | 219:993c9b0acbcc | 55 | #define STM_MODE_EVT_FALLING (10) |
mbed_official | 219:993c9b0acbcc | 56 | #define STM_MODE_EVT_RISING_FALLING (11) |
mbed_official | 219:993c9b0acbcc | 57 | |
mbed_official | 219:993c9b0acbcc | 58 | // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H) |
mbed_official | 219:993c9b0acbcc | 59 | // Low nibble = pin number |
mbed_official | 219:993c9b0acbcc | 60 | #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF) |
mbed_official | 219:993c9b0acbcc | 61 | #define STM_PIN(X) ((uint32_t)(X) & 0xF) |
mbed_official | 219:993c9b0acbcc | 62 | |
mbed_official | 219:993c9b0acbcc | 63 | typedef enum { |
mbed_official | 219:993c9b0acbcc | 64 | PIN_INPUT, |
mbed_official | 219:993c9b0acbcc | 65 | PIN_OUTPUT |
mbed_official | 219:993c9b0acbcc | 66 | } PinDirection; |
mbed_official | 219:993c9b0acbcc | 67 | |
mbed_official | 219:993c9b0acbcc | 68 | typedef enum { |
mbed_official | 219:993c9b0acbcc | 69 | PA_0 = 0x00, |
mbed_official | 219:993c9b0acbcc | 70 | PA_1 = 0x01, |
mbed_official | 219:993c9b0acbcc | 71 | PA_2 = 0x02, |
mbed_official | 219:993c9b0acbcc | 72 | PA_3 = 0x03, |
mbed_official | 219:993c9b0acbcc | 73 | PA_4 = 0x04, |
mbed_official | 219:993c9b0acbcc | 74 | PA_5 = 0x05, |
mbed_official | 219:993c9b0acbcc | 75 | PA_6 = 0x06, |
mbed_official | 219:993c9b0acbcc | 76 | PA_7 = 0x07, |
mbed_official | 219:993c9b0acbcc | 77 | PA_8 = 0x08, |
mbed_official | 219:993c9b0acbcc | 78 | PA_9 = 0x09, |
mbed_official | 219:993c9b0acbcc | 79 | PA_10 = 0x0A, |
mbed_official | 219:993c9b0acbcc | 80 | PA_11 = 0x0B, |
mbed_official | 219:993c9b0acbcc | 81 | PA_12 = 0x0C, |
mbed_official | 219:993c9b0acbcc | 82 | PA_13 = 0x0D, |
mbed_official | 219:993c9b0acbcc | 83 | PA_14 = 0x0E, |
mbed_official | 219:993c9b0acbcc | 84 | PA_15 = 0x0F, |
mbed_official | 219:993c9b0acbcc | 85 | |
mbed_official | 219:993c9b0acbcc | 86 | PB_0 = 0x10, |
mbed_official | 219:993c9b0acbcc | 87 | PB_1 = 0x11, |
mbed_official | 219:993c9b0acbcc | 88 | PB_2 = 0x12, |
mbed_official | 219:993c9b0acbcc | 89 | PB_3 = 0x13, |
mbed_official | 219:993c9b0acbcc | 90 | PB_4 = 0x14, |
mbed_official | 219:993c9b0acbcc | 91 | PB_5 = 0x15, |
mbed_official | 219:993c9b0acbcc | 92 | PB_6 = 0x16, |
mbed_official | 219:993c9b0acbcc | 93 | PB_7 = 0x17, |
mbed_official | 219:993c9b0acbcc | 94 | PB_8 = 0x18, |
mbed_official | 219:993c9b0acbcc | 95 | PB_9 = 0x19, |
mbed_official | 219:993c9b0acbcc | 96 | PB_10 = 0x1A, |
mbed_official | 219:993c9b0acbcc | 97 | PB_11 = 0x1B, |
mbed_official | 219:993c9b0acbcc | 98 | PB_12 = 0x1C, |
mbed_official | 219:993c9b0acbcc | 99 | PB_13 = 0x1D, |
mbed_official | 219:993c9b0acbcc | 100 | PB_14 = 0x1E, |
mbed_official | 219:993c9b0acbcc | 101 | PB_15 = 0x1F, |
mbed_official | 219:993c9b0acbcc | 102 | |
mbed_official | 219:993c9b0acbcc | 103 | PC_0 = 0x20, |
mbed_official | 219:993c9b0acbcc | 104 | PC_1 = 0x21, |
mbed_official | 219:993c9b0acbcc | 105 | PC_2 = 0x22, |
mbed_official | 219:993c9b0acbcc | 106 | PC_3 = 0x23, |
mbed_official | 219:993c9b0acbcc | 107 | PC_4 = 0x24, |
mbed_official | 219:993c9b0acbcc | 108 | PC_5 = 0x25, |
mbed_official | 219:993c9b0acbcc | 109 | PC_6 = 0x26, |
mbed_official | 219:993c9b0acbcc | 110 | PC_7 = 0x27, |
mbed_official | 219:993c9b0acbcc | 111 | PC_8 = 0x28, |
mbed_official | 219:993c9b0acbcc | 112 | PC_9 = 0x29, |
mbed_official | 219:993c9b0acbcc | 113 | PC_10 = 0x2A, |
mbed_official | 219:993c9b0acbcc | 114 | PC_11 = 0x2B, |
mbed_official | 219:993c9b0acbcc | 115 | PC_12 = 0x2C, |
mbed_official | 219:993c9b0acbcc | 116 | PC_13 = 0x2D, |
mbed_official | 219:993c9b0acbcc | 117 | PC_14 = 0x2E, |
mbed_official | 219:993c9b0acbcc | 118 | PC_15 = 0x2F, |
mbed_official | 219:993c9b0acbcc | 119 | |
mbed_official | 219:993c9b0acbcc | 120 | PD_2 = 0x32, |
mbed_official | 219:993c9b0acbcc | 121 | |
mbed_official | 219:993c9b0acbcc | 122 | PF_0 = 0x50, |
mbed_official | 219:993c9b0acbcc | 123 | PF_1 = 0x51, |
mbed_official | 219:993c9b0acbcc | 124 | |
mbed_official | 219:993c9b0acbcc | 125 | // Arduino connector namings |
mbed_official | 219:993c9b0acbcc | 126 | A0 = PA_0, |
mbed_official | 219:993c9b0acbcc | 127 | A1 = PA_1, |
mbed_official | 219:993c9b0acbcc | 128 | A2 = PA_4, |
mbed_official | 219:993c9b0acbcc | 129 | A3 = PB_0, |
mbed_official | 219:993c9b0acbcc | 130 | A4 = PC_1, |
mbed_official | 219:993c9b0acbcc | 131 | A5 = PC_0, |
mbed_official | 219:993c9b0acbcc | 132 | D0 = PA_3, |
mbed_official | 219:993c9b0acbcc | 133 | D1 = PA_2, |
mbed_official | 219:993c9b0acbcc | 134 | D2 = PA_10, |
mbed_official | 219:993c9b0acbcc | 135 | D3 = PB_3, |
mbed_official | 219:993c9b0acbcc | 136 | D4 = PB_5, |
mbed_official | 219:993c9b0acbcc | 137 | D5 = PB_4, |
mbed_official | 219:993c9b0acbcc | 138 | D6 = PB_10, |
mbed_official | 219:993c9b0acbcc | 139 | D7 = PA_8, |
mbed_official | 219:993c9b0acbcc | 140 | D8 = PA_9, |
mbed_official | 219:993c9b0acbcc | 141 | D9 = PC_7, |
mbed_official | 219:993c9b0acbcc | 142 | D10 = PB_6, |
mbed_official | 219:993c9b0acbcc | 143 | D11 = PA_7, |
mbed_official | 219:993c9b0acbcc | 144 | D12 = PA_6, |
mbed_official | 219:993c9b0acbcc | 145 | D13 = PA_5, |
mbed_official | 219:993c9b0acbcc | 146 | D14 = PB_9, |
mbed_official | 219:993c9b0acbcc | 147 | D15 = PB_8, |
mbed_official | 219:993c9b0acbcc | 148 | |
mbed_official | 219:993c9b0acbcc | 149 | // Generic signals namings |
mbed_official | 219:993c9b0acbcc | 150 | LED1 = PA_5, |
mbed_official | 219:993c9b0acbcc | 151 | LED2 = PA_5, |
mbed_official | 219:993c9b0acbcc | 152 | LED3 = PA_5, |
mbed_official | 219:993c9b0acbcc | 153 | LED4 = PA_5, |
mbed_official | 219:993c9b0acbcc | 154 | USER_BUTTON = PC_13, |
mbed_official | 219:993c9b0acbcc | 155 | SERIAL_TX = PA_2, |
mbed_official | 219:993c9b0acbcc | 156 | SERIAL_RX = PA_3, |
mbed_official | 219:993c9b0acbcc | 157 | USBTX = PA_2, |
mbed_official | 219:993c9b0acbcc | 158 | USBRX = PA_3, |
mbed_official | 219:993c9b0acbcc | 159 | I2C_SCL = PB_8, |
mbed_official | 219:993c9b0acbcc | 160 | I2C_SDA = PB_9, |
mbed_official | 219:993c9b0acbcc | 161 | SPI_MOSI = PA_7, |
mbed_official | 219:993c9b0acbcc | 162 | SPI_MISO = PA_6, |
mbed_official | 219:993c9b0acbcc | 163 | SPI_SCK = PA_5, |
mbed_official | 219:993c9b0acbcc | 164 | SPI_CS = PB_6, |
mbed_official | 219:993c9b0acbcc | 165 | PWM_OUT = PB_3, |
mbed_official | 219:993c9b0acbcc | 166 | |
mbed_official | 219:993c9b0acbcc | 167 | // Not connected |
mbed_official | 219:993c9b0acbcc | 168 | NC = (int)0xFFFFFFFF |
mbed_official | 219:993c9b0acbcc | 169 | } PinName; |
mbed_official | 219:993c9b0acbcc | 170 | |
mbed_official | 219:993c9b0acbcc | 171 | typedef enum { |
mbed_official | 219:993c9b0acbcc | 172 | PullNone = 0, |
mbed_official | 219:993c9b0acbcc | 173 | PullUp = 1, |
mbed_official | 219:993c9b0acbcc | 174 | PullDown = 2, |
mbed_official | 219:993c9b0acbcc | 175 | OpenDrain = 3, |
mbed_official | 219:993c9b0acbcc | 176 | PullDefault = PullNone |
mbed_official | 219:993c9b0acbcc | 177 | } PinMode; |
mbed_official | 219:993c9b0acbcc | 178 | |
mbed_official | 219:993c9b0acbcc | 179 | #ifdef __cplusplus |
mbed_official | 219:993c9b0acbcc | 180 | } |
mbed_official | 219:993c9b0acbcc | 181 | #endif |
mbed_official | 219:993c9b0acbcc | 182 | |
mbed_official | 219:993c9b0acbcc | 183 | #endif |