]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_DISCO_F303VC/PinNames.h
Merge commit '4d116a04e94cf0d19317d5b44e4fa9f34a3e5594'
[max/tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_STM / TARGET_STM32F3 / TARGET_DISCO_F303VC / 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 // See stm32f3xx_hal_gpio.h and stm32f3xx_hal_gpio_ex.h for values of MODE, PUPD and AFNUM
40 #define STM_PIN_DATA(MODE, PUPD, AFNUM)  ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0)))
41 #define STM_PIN_MODE(X)   (((X) >> 0) & 0x0F)
42 #define STM_PIN_PUPD(X)   (((X) >> 4) & 0x07)
43 #define STM_PIN_AFNUM(X)  (((X) >> 7) & 0x0F)
44 #define STM_MODE_INPUT              (0)
45 #define STM_MODE_OUTPUT_PP          (1)
46 #define STM_MODE_OUTPUT_OD          (2)
47 #define STM_MODE_AF_PP              (3)
48 #define STM_MODE_AF_OD              (4)
49 #define STM_MODE_ANALOG             (5)
50 #define STM_MODE_IT_RISING          (6)
51 #define STM_MODE_IT_FALLING         (7)
52 #define STM_MODE_IT_RISING_FALLING  (8)
53 #define STM_MODE_EVT_RISING         (9)
54 #define STM_MODE_EVT_FALLING        (10)
55 #define STM_MODE_EVT_RISING_FALLING (11)
56 #define STM_MODE_IT_EVT_RESET       (12)
57
58 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
59 // Low nibble  = pin number
60 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
61 #define STM_PIN(X)  ((uint32_t)(X) & 0xF)
62
63 typedef enum {
64     PIN_INPUT,
65     PIN_OUTPUT
66 } PinDirection;
67
68 typedef enum {
69   PA_0  = 0x00,
70   PA_1  = 0x01,
71   PA_2  = 0x02,
72   PA_3  = 0x03,
73   PA_4  = 0x04,
74   PA_5  = 0x05,
75   PA_6  = 0x06,
76   PA_7  = 0x07,
77   PA_8  = 0x08,
78   PA_9  = 0x09,
79   PA_10 = 0x0A,
80   PA_11 = 0x0B,
81   PA_12 = 0x0C,
82   PA_13 = 0x0D,
83   PA_14 = 0x0E,
84   PA_15 = 0x0F,
85
86   PB_0  = 0x10,
87   PB_1  = 0x11,
88   PB_2  = 0x12,
89   PB_3  = 0x13,
90   PB_4  = 0x14,
91   PB_5  = 0x15,
92   PB_6  = 0x16,
93   PB_7  = 0x17,
94   PB_8  = 0x18,
95   PB_9  = 0x19,
96   PB_10 = 0x1A,
97   PB_11 = 0x1B,
98   PB_12 = 0x1C,
99   PB_13 = 0x1D,
100   PB_14 = 0x1E,
101   PB_15 = 0x1F,
102
103   PC_0  = 0x20,
104   PC_1  = 0x21,
105   PC_2  = 0x22,
106   PC_3  = 0x23,
107   PC_4  = 0x24,
108   PC_5  = 0x25,
109   PC_6  = 0x26,
110   PC_7  = 0x27,
111   PC_8  = 0x28,
112   PC_9  = 0x29,
113   PC_10 = 0x2A,
114   PC_11 = 0x2B,
115   PC_12 = 0x2C,
116   PC_13 = 0x2D,
117   PC_14 = 0x2E,
118   PC_15 = 0x2F,
119
120   PD_0  = 0x30,
121   PD_1  = 0x31,
122   PD_2  = 0x32,
123   PD_3  = 0x33,
124   PD_4  = 0x34,
125   PD_5  = 0x35,
126   PD_6  = 0x36,
127   PD_7  = 0x37,
128   PD_8  = 0x38,
129   PD_9  = 0x39,
130   PD_10 = 0x3A,
131   PD_11 = 0x3B,
132   PD_12 = 0x3C,
133   PD_13 = 0x3D,
134   PD_14 = 0x3E,
135   PD_15 = 0x3F,
136
137   PE_0  = 0x40,
138   PE_1  = 0x41,
139   PE_2  = 0x42,
140   PE_3  = 0x43,
141   PE_4  = 0x44,
142   PE_5  = 0x45,
143   PE_6  = 0x46,
144   PE_7  = 0x47,
145   PE_8  = 0x48,
146   PE_9  = 0x49,
147   PE_10 = 0x4A,
148   PE_11 = 0x4B,
149   PE_12 = 0x4C,
150   PE_13 = 0x4D,
151   PE_14 = 0x4E,
152   PE_15 = 0x4F,
153
154   PF_0  = 0x50,
155   PF_1  = 0x51,
156   PF_2  = 0x52,
157   PF_3  = 0x53,
158   PF_4  = 0x54,
159   PF_5  = 0x55,
160   PF_6  = 0x56,
161   PF_7  = 0x57,
162   PF_8  = 0x58,
163   PF_9  = 0x59,
164   PF_10 = 0x5A,
165   PF_11 = 0x5B,
166   PF_12 = 0x5C,
167   PF_13 = 0x5D,
168   PF_14 = 0x5E,
169   PF_15 = 0x5F,
170
171     // Arduino connector namings
172     A0          = PA_0,
173     A1          = PA_1,
174     A2          = PA_4,
175     A3          = PB_0,
176     A4          = PC_1,
177     A5          = PC_0,
178     D0          = PA_3,
179     D1          = PA_2,
180     D2          = PA_10,
181     D3          = PB_3,
182     D4          = PB_5,
183     D5          = PB_4,
184     D6          = PB_10,
185     D7          = PA_8,
186     D8          = PA_9,
187     D9          = PC_7,
188     D10         = PB_6,
189     D11         = PB_15,
190     D12         = PB_14,
191     D13         = PB_13,
192     D14         = PB_9,
193     D15         = PB_8,
194
195     // Generic signals namings
196     LED1        = PE_9,
197     LED2        = PE_8,
198     LED3        = PE_9,
199     LED4        = PE_8,
200     LED5        = PE_10,
201     LED6        = PE_15,
202     LED7        = PE_11,
203     LED8        = PE_14,
204     LED9        = PE_12,
205     LED10       = PE_13,
206     USER_BUTTON = PA_0,
207     SERIAL_TX   = PA_2,
208     SERIAL_RX   = PA_3,
209     USBTX       = PA_2,
210     USBRX       = PA_3,
211     I2C_SCL     = PB_8,
212     I2C_SDA     = PB_9,
213     SPI_MOSI    = PB_15,
214     SPI_MISO    = PB_14,
215     SPI_SCK     = PB_13,
216     SPI_CS      = PB_6,
217     PWM_OUT     = PB_4,
218
219     // Not connected
220     NC = (int)0xFFFFFFFF
221 } PinName;
222
223 typedef enum {
224     PullNone  = 0,
225     PullUp    = 1,
226     PullDown  = 2,
227     OpenDrain = 3,
228     PullDefault = PullNone
229 } PinMode;
230
231 #ifdef __cplusplus
232 }
233 #endif
234
235 #endif