]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/PinNames.h
allow overriding of TARGET
[qmk_firmware.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_STM / TARGET_STM32F4 / TARGET_MTS_MDOT_F411RE / 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 stm32f4xx_hal_gpio.h and stm32f4xx_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_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED)  ((int)(((INVERTED & 0x01) << 15) | ((CHANNEL & 0x0F) << 11) | ((AFNUM & 0x0F) << 7) | ((PUPD & 0x07) << 4) | ((MODE & 0x0F) << 0)))
42 #define STM_PIN_MODE(X)   (((X) >> 0) & 0x0F)
43 #define STM_PIN_PUPD(X)   (((X) >> 4) & 0x07)
44 #define STM_PIN_AFNUM(X)  (((X) >> 7) & 0x0F)
45 #define STM_PIN_CHANNEL(X)  (((X) >> 11) & 0x0F)
46 #define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
47 #define STM_MODE_INPUT              (0)
48 #define STM_MODE_OUTPUT_PP          (1)
49 #define STM_MODE_OUTPUT_OD          (2)
50 #define STM_MODE_AF_PP              (3)
51 #define STM_MODE_AF_OD              (4)
52 #define STM_MODE_ANALOG             (5)
53 #define STM_MODE_IT_RISING          (6)
54 #define STM_MODE_IT_FALLING         (7)
55 #define STM_MODE_IT_RISING_FALLING  (8)
56 #define STM_MODE_EVT_RISING         (9)
57 #define STM_MODE_EVT_FALLING        (10)
58 #define STM_MODE_EVT_RISING_FALLING (11)
59 #define STM_MODE_IT_EVT_RESET       (12)
60
61 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
62 // Low nibble  = pin number
63 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
64 #define STM_PIN(X)  ((uint32_t)(X) & 0xF)
65
66 typedef enum {
67     PIN_INPUT,
68     PIN_OUTPUT
69 } PinDirection;
70
71 typedef enum {
72     PA_0  = 0x00,
73     PA_1  = 0x01,
74     PA_2  = 0x02,
75     PA_3  = 0x03,
76     PA_4  = 0x04,
77     PA_5  = 0x05,
78     PA_6  = 0x06,
79     PA_7  = 0x07,
80     PA_8  = 0x08,
81     PA_9  = 0x09,
82     PA_10 = 0x0A,
83     PA_11 = 0x0B,
84     PA_12 = 0x0C,
85     PA_13 = 0x0D,
86     PA_14 = 0x0E,
87     PA_15 = 0x0F,
88
89     PB_0  = 0x10,
90     PB_1  = 0x11,
91     PB_2  = 0x12,
92     PB_3  = 0x13,
93     PB_4  = 0x14,
94     PB_5  = 0x15,
95     PB_6  = 0x16,
96     PB_7  = 0x17,
97     PB_8  = 0x18,
98     PB_9  = 0x19,
99     PB_10 = 0x1A,
100     PB_12 = 0x1C,
101     PB_13 = 0x1D,
102     PB_14 = 0x1E,
103     PB_15 = 0x1F,
104
105     PC_0  = 0x20,
106     PC_1  = 0x21,
107     PC_2  = 0x22,
108     PC_3  = 0x23,
109     PC_4  = 0x24,
110     PC_5  = 0x25,
111     PC_6  = 0x26,
112     PC_7  = 0x27,
113     PC_8  = 0x28,
114     PC_9  = 0x29,
115     PC_10 = 0x2A,
116     PC_11 = 0x2B,
117     PC_12 = 0x2C,
118     PC_13 = 0x2D,
119     PC_14 = 0x2E,
120     PC_15 = 0x2F,
121
122     PD_2  = 0x32,
123
124     PH_0  = 0x70,
125     PH_1  = 0x71,
126
127     // Generic signals namings
128     XBEE_DOUT        = PA_2,
129     XBEE_DIN         = PA_3,
130     XBEE_AD0         = PB_1,
131     XBEE_AD1         = PB_0,
132     XBEE_AD2         = PA_5,
133     XBEE_AD3         = PA_4,
134     XBEE_AD4         = PA_7,
135     XBEE_AD5         = PC_1,
136     XBEE_AD6         = PA_1,
137     XBEE_DIO0        = PB_1,
138     XBEE_DIO1        = PB_0,
139     XBEE_DIO2        = PA_5,
140     XBEE_DIO3        = PA_4,
141     XBEE_DIO4        = PA_7,
142     XBEE_DIO5        = PC_1,
143     XBEE_DIO6        = PA_1,
144     XBEE_DO8         = PA_6,
145     XBEE_DI8         = PA_11,
146     XBEE_PWM0        = PA_8,
147     XBEE_PWM1        = PC_9,
148     XBEE_CTS         = PA_0,
149     XBEE_RTS         = PA_1,
150     XBEE_DTR         = PA_11,
151     XBEE_RSSI        = PA_8,
152     XBEE_SLEEPRQ     = PA_11,
153     XBEE_ON_SLEEP    = PC_13,
154     XBEE_ASSOCIATE   = PC_1,
155     XBEE_USB_RES     = PA_12,
156
157     // needed for mbed to build tests
158     LED1        = PA_0,
159
160     // XBEE_DOUT/DIN, RS232 port on UDK board
161     SERIAL_TX   = PA_2,
162     SERIAL_RX   = PA_3,
163
164     // DB_TX/RX, USB port on UDK board
165     DB_TX       = PA_9,
166     DB_RX       = PA_10,
167     USBTX       = PA_9,
168     USBRX       = PA_10,
169
170     // Multiplexed with XBEE pins
171     I2C_SCL     = PA_8,
172     I2C_SDA     = PC_9,
173     SPI1_MOSI   = PA_7,
174     SPI1_MISO   = PA_6,
175     SPI1_SCK    = PA_5,
176     SPI1_CS     = PA_4,
177
178     // SPI flash
179     SPI3_MOSI   = PC_12,
180     SPI3_MISO   = PC_11,
181     SPI3_SCK    = PC_10,
182     SPI3_CS     = PC_6,
183     FLASH_HOLD  = PC_7,
184     FLASH_WP    = PC_8,
185
186     // LoRa
187     LORA_RESET  = PC_0,
188     LORA_RXCTL  = PC_2,
189     LORA_TXCTL  = PC_3,
190     LORA_DIO0   = PB_5,
191     LORA_DIO1   = PB_6,
192     LORA_DIO2   = PB_7,
193     LORA_DIO3   = PB_8,
194     LORA_DIO4   = PB_9,
195     LORA_DIO5   = PB_10,
196     // LoRa/SPI2
197     LORA_NSS    = PB_12,
198     LORA_SCK    = PB_13,
199     LORA_MISO   = PB_14,
200     LORA_MOSI   = PB_15,
201
202     // Not connected
203     NC = (int)0xFFFFFFFF
204 } PinName;
205
206 typedef enum {
207     PullNone  = 0,
208     PullUp    = 1,
209     PullDown  = 2,
210     OpenDrain = 3,
211     PullDefault = PullNone
212 } PinMode;
213
214 #ifdef __cplusplus
215 }
216 #endif
217
218 #endif