1+ /*
2+ *******************************************************************************
3+ * Copyright (c) 2020, STMicroelectronics
4+ * All rights reserved.
5+ *
6+ * This software component is licensed by ST under BSD 3-Clause license,
7+ * the "License"; You may not use this file except in compliance with the
8+ * License. You may obtain a copy of the License at:
9+ * opensource.org/licenses/BSD-3-Clause
10+ *
11+ *******************************************************************************
12+ */
13+
14+ #pragma once
15+
16+ /*----------------------------------------------------------------------------
17+ * STM32 pins number
18+ *----------------------------------------------------------------------------*/
19+ #define PB15 0
20+ #define PB14 1
21+ #define PA10 2
22+ #define PB3 3
23+ #define PB5 4
24+ #define PB4 5
25+ #define PB10 6
26+ #define PA8 7
27+ #define PC7 8
28+ #define PC6 9
29+ #define PC9 10
30+ #define PA7 PIN_A11
31+ #define PA6 PIN_A12
32+ #define PA5 PIN_A13
33+ #define PB7 14
34+ #define PB6 15
35+ // CN7 odd pins
36+ #define PC10 16
37+ #define PC12 17
38+ // PA13 and PA14 are shared with SWD signals connected to STLINK-V3EC.
39+ // It is not recommended to use them as I/O pins.
40+ // By default, they are used as SWD signals (SB40 and SB41 ON).
41+ #define PA13 18
42+ #define PA14 19
43+ #define PA15 20
44+ #define PC13 21
45+ #define PC14 22
46+ #define PC15 23
47+ #define PH0 24
48+ #define PH1 25
49+ #define PC2 PIN_A6
50+ #define PC3 PIN_A7
51+ // CN7 even pins
52+ #define PC11 28
53+ #define PD2 29
54+ #define PA0 PIN_A0
55+ #define PA1 PIN_A1
56+ #define PA2 PIN_A2
57+ #define PB0 PIN_A3
58+ #define PC1 PIN_A4
59+ #define PC0 PIN_A5
60+ // CN10 odd pins are D0-D15
61+ // CN10 even pins
62+ #define PC8 36
63+ #define PC5 PIN_A8
64+ #define PA12 38
65+ #define PA11 39
66+ #define PB12 40
67+ #define PB2 41
68+ #define PB1 PIN_A9
69+ // 43 is PB15 (0)
70+ // 44 is PB14 (1)
71+ #define PB13 45
72+ #define PC4 PIN_A10
73+ #define PB8 47
74+ // Other
75+ #define PA3 PIN_A14
76+ #define PA4 PIN_A15
77+ #define PA9 50 // USB_VBUS
78+
79+ // Alternate pins number
80+ #define PA0_ALT1 (PA0 | ALT1)
81+ #define PA0_ALT2 (PA0 | ALT2)
82+ #define PA1_ALT1 (PA1 | ALT1)
83+ #define PA2_ALT1 (PA2 | ALT1)
84+ #define PA3_ALT1 (PA3 | ALT1)
85+ #define PA4_ALT1 (PA4 | ALT1)
86+ #define PA5_ALT1 (PA5 | ALT1)
87+ #define PA7_ALT1 (PA7 | ALT1)
88+ #define PA7_ALT2 (PA7 | ALT2)
89+ #define PA8_ALT1 (PA8 | ALT1)
90+ #define PA8_ALT2 (PA8 | ALT2)
91+ #define PA9_ALT1 (PA9 | ALT1)
92+ #define PA10_ALT1 (PA10 | ALT1)
93+ #define PA11_ALT1 (PA11 | ALT1)
94+ #define PA12_ALT1 (PA12 | ALT1)
95+ #define PA13_ALT1 (PA13 | ALT1)
96+ #define PA14_ALT1 (PA14 | ALT1)
97+ #define PA14_ALT2 (PA14 | ALT2)
98+ #define PA15_ALT1 (PA15 | ALT1)
99+ #define PB0_ALT1 (PB0 | ALT1)
100+ #define PB1_ALT1 (PB1 | ALT1)
101+ #define PB1_ALT2 (PB1 | ALT2)
102+ #define PB2_ALT1 (PB2 | ALT1)
103+ #define PB3_ALT1 (PB3 | ALT1)
104+ #define PB4_ALT1 (PB4 | ALT1)
105+ #define PB4_ALT2 (PB4 | ALT2)
106+ #define PB5_ALT1 (PB5 | ALT1)
107+ #define PB6_ALT1 (PB6 | ALT1)
108+ #define PB6_ALT2 (PB6 | ALT2)
109+ #define PB7_ALT1 (PB7 | ALT1)
110+ #define PB13_ALT1 (PB13 | ALT1)
111+ #define PB14_ALT1 (PB14 | ALT1)
112+ #define PB15_ALT1 (PB15 | ALT1)
113+ #define PB15_ALT2 (PB15 | ALT2)
114+ #define PC1_ALT1 (PC1 | ALT1)
115+ #define PC2_ALT1 (PC2 | ALT1)
116+ #define PC3_ALT1 (PC3 | ALT1)
117+ #define PC6_ALT1 (PC6 | ALT1)
118+ #define PC7_ALT1 (PC7 | ALT1)
119+ #define PC8_ALT1 (PC8 | ALT1)
120+ #define PC9_ALT1 (PC9 | ALT1)
121+ #define PC12_ALT1 (PC12 | ALT1)
122+
123+ #define NUM_DIGITAL_PINS 51
124+ #define NUM_ANALOG_INPUTS 16
125+
126+ // On-board LED pin number
127+ #define LED_GREEN PA5
128+ #ifndef LED_BUILTIN
129+ #define LED_BUILTIN LED_GREEN
130+ #endif
131+
132+ // On-board user button
133+ #ifndef USER_BTN
134+ #define USER_BTN PC13
135+ #endif
136+
137+ // Timer Definitions
138+ // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
139+ #ifndef TIMER_TONE
140+ #define TIMER_TONE TIM6
141+ #endif
142+ #ifndef TIMER_SERVO
143+ #define TIMER_SERVO TIM7
144+ #endif
145+
146+ // UART Definitions
147+ #ifndef SERIAL_UART_INSTANCE
148+ #define SERIAL_UART_INSTANCE 3
149+ #endif
150+
151+ // Default pin used for generic 'Serial' instance
152+ // Mandatory for Firmata
153+ #ifndef PIN_SERIAL_RX
154+ #define PIN_SERIAL_RX PA_3_ALT1
155+ #endif
156+ #ifndef PIN_SERIAL_TX
157+ #define PIN_SERIAL_TX PA4
158+ #endif
159+
160+ #define HSE_VALUE 24000000UL /*!< Value of the External oscillator in Hz */
161+
162+ // Extra HAL modules
163+ #if !defined(HAL_DAC_MODULE_DISABLED )
164+ #define HAL_DAC_MODULE_ENABLED
165+ #endif
166+
167+ /*----------------------------------------------------------------------------
168+ * Arduino objects - C++ only
169+ *----------------------------------------------------------------------------*/
170+
171+ #ifdef __cplusplus
172+ // These serial port names are intended to allow libraries and architecture-neutral
173+ // sketches to automatically default to the correct port name for a particular type
174+ // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
175+ // the first hardware serial port whose RX/TX pins are not dedicated to another use.
176+ //
177+ // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
178+ //
179+ // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
180+ //
181+ // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
182+ //
183+ // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
184+ //
185+ // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
186+ // pins are NOT connected to anything by default.
187+ #ifndef SERIAL_PORT_MONITOR
188+ #define SERIAL_PORT_MONITOR Serial
189+ #endif
190+ #ifndef SERIAL_PORT_HARDWARE
191+ #define SERIAL_PORT_HARDWARE Serial
192+ #endif
193+ #endif
0 commit comments