]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3XX/PinNames.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_STM / TARGET_STM32F3XX / PinNames.h
1 /* mbed Microcontroller Library
2 *******************************************************************************
3 * Copyright (c) 2014, STMicroelectronics
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *******************************************************************************
29 */
30 #ifndef MBED_PINNAMES_H
31 #define MBED_PINNAMES_H
32
33 #include "cmsis.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 // MODE (see GPIOMode_TypeDef structure)
40 // OTYPE (see GPIOOType_TypeDef structure)
41 // PUPD (see GPIOPuPd_TypeDef structure)
42 // AFNUM (see AF_mapping constant table, 0xFF is not used)
43 #define STM_PIN_DATA(MODE, OTYPE, PUPD, AFNUM) (((AFNUM)<<8)|((PUPD)<<4)|((OTYPE)<<2)|((MODE)<<0))
44 #define STM_PIN_MODE(X) (((X)>>0) & 0x3)
45 #define STM_PIN_OTYPE(X) (((X)>>2) & 0x1)
46 #define STM_PIN_PUPD(X) (((X)>>4) & 0x3)
47 #define STM_PIN_AFNUM(X) (((X)>>8) & 0xF)
48
49 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
50 // Low nibble = pin number
51 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
52 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
53
54 typedef enum {
55 PIN_INPUT,
56 PIN_OUTPUT
57 } PinDirection;
58
59 typedef enum {
60 PA_0 = 0x00,
61 PA_1 = 0x01,
62 PA_2 = 0x02,
63 PA_3 = 0x03,
64 PA_4 = 0x04,
65 PA_5 = 0x05,
66 PA_6 = 0x06,
67 PA_7 = 0x07,
68 PA_8 = 0x08,
69 PA_9 = 0x09,
70 PA_10 = 0x0A,
71 PA_11 = 0x0B,
72 PA_12 = 0x0C,
73 PA_13 = 0x0D,
74 PA_14 = 0x0E,
75 PA_15 = 0x0F,
76
77 PB_0 = 0x10,
78 PB_1 = 0x11,
79 PB_2 = 0x12,
80 PB_3 = 0x13,
81 PB_4 = 0x14,
82 PB_5 = 0x15,
83 PB_6 = 0x16,
84 PB_7 = 0x17,
85 PB_8 = 0x18,
86 PB_9 = 0x19,
87 PB_10 = 0x1A,
88 PB_11 = 0x1B,
89 PB_12 = 0x1C,
90 PB_13 = 0x1D,
91 PB_14 = 0x1E,
92 PB_15 = 0x1F,
93
94 PC_0 = 0x20,
95 PC_1 = 0x21,
96 PC_2 = 0x22,
97 PC_3 = 0x23,
98 PC_4 = 0x24,
99 PC_5 = 0x25,
100 PC_6 = 0x26,
101 PC_7 = 0x27,
102 PC_8 = 0x28,
103 PC_9 = 0x29,
104 PC_10 = 0x2A,
105 PC_11 = 0x2B,
106 PC_12 = 0x2C,
107 PC_13 = 0x2D,
108 PC_14 = 0x2E,
109 PC_15 = 0x2F,
110
111 PD_0 = 0x30,
112 PD_1 = 0x31,
113 PD_2 = 0x32,
114 PD_3 = 0x33,
115 PD_4 = 0x34,
116 PD_5 = 0x35,
117 PD_6 = 0x36,
118 PD_7 = 0x37,
119 PD_8 = 0x38,
120 PD_9 = 0x39,
121 PD_10 = 0x3A,
122 PD_11 = 0x3B,
123 PD_12 = 0x3C,
124 PD_13 = 0x3D,
125 PD_14 = 0x3E,
126 PD_15 = 0x3F,
127
128 PE_0 = 0x40,
129 PE_1 = 0x41,
130 PE_2 = 0x42,
131 PE_3 = 0x43,
132 PE_4 = 0x44,
133 PE_5 = 0x45,
134 PE_6 = 0x46,
135 PE_7 = 0x47,
136 PE_8 = 0x48,
137 PE_9 = 0x49,
138 PE_10 = 0x4A,
139 PE_11 = 0x4B,
140 PE_12 = 0x4C,
141 PE_13 = 0x4D,
142 PE_14 = 0x4E,
143 PE_15 = 0x4F,
144
145 PF_0 = 0x50,
146 PF_1 = 0x51,
147 PF_2 = 0x52,
148 PF_3 = 0x53,
149 PF_4 = 0x54,
150 PF_5 = 0x55,
151 PF_6 = 0x56,
152 PF_7 = 0x57,
153 PF_8 = 0x58,
154 PF_9 = 0x59,
155 PF_10 = 0x5A,
156 PF_11 = 0x5B,
157 PF_12 = 0x5C,
158 PF_13 = 0x5D,
159 PF_14 = 0x5E,
160 PF_15 = 0x5F,
161
162 LED1 = PE_9,
163
164 // Not connected
165 NC = (int)0xFFFFFFFF
166 } PinName;
167
168 typedef enum {
169 PullNone = 0,
170 PullUp = 1,
171 PullDown = 2,
172 OpenDrain = 3,
173 PullDefault = PullNone
174 } PinMode;
175
176 #ifdef __cplusplus
177 }
178 #endif
179
180 #endif
Imprint / Impressum