2 *******************************************************************************
3 * Copyright (c) 2018, STMicroelectronics
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
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.
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 *******************************************************************************
30 #ifndef _VARIANT_ARDUINO_STM32_
31 #define _VARIANT_ARDUINO_STM32_
37 /*----------------------------------------------------------------------------
39 *----------------------------------------------------------------------------*/
41 // Bluepill USB connector on the top, MCU side - Blackpill USB connector on bottom, MCU Side (pins are reversed vertically for Arduino Ananlog pin correct sequence.
51 #define PA12 8 // USB DP
52 #define PA11 9 // USB DM
59 #define PB12 16 // LED Blackpill
61 #define PC13 17 // LED Bluepill
77 #define PB2 32 // BOOT1
78 #define PA13 33 // SWDI0
79 #define PA14 34 // SWCLK
81 // This must be a literal
82 #define NUM_DIGITAL_PINS 35
83 // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
84 #define NUM_ANALOG_INPUTS 10
85 #define NUM_ANALOG_FIRST 20
87 // On-board LED pin number
88 #if defined(ARDUINO_BLUEPILL_F103C6) || defined(ARDUINO_BLUEPILL_F103C8) ||\
89 defined(ARDUINO_BLUEPILL_F103CB)
90 #define LED_BUILTIN PC13
93 // Default for Blackpill
94 #define LED_BUILTIN PB12
97 #define LED_GREEN LED_BUILTIN
100 #define PIN_SPI_SS PA4
101 #define PIN_SPI_MOSI PA7
102 #define PIN_SPI_MISO PA6
103 #define PIN_SPI_SCK PA5
106 #define PIN_WIRE_SDA PB7
107 #define PIN_WIRE_SCL PB6
110 // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
111 #define TIMER_TONE TIM3
112 #define TIMER_SERVO TIM2
115 #define SERIAL_UART_INSTANCE 1
116 // Default pin used for 'Serial' instance
117 // Mandatory for Firmata
118 #define PIN_SERIAL_RX PA10
119 #define PIN_SERIAL_TX PA9
121 // Adjust IRQ priority
122 #define TIM_IRQ_PRIO 4
123 #define EXTI_IRQ_PRIO 4
128 /*----------------------------------------------------------------------------
129 * Arduino objects - C++ only
130 *----------------------------------------------------------------------------*/
133 // These serial port names are intended to allow libraries and architecture-neutral
134 // sketches to automatically default to the correct port name for a particular type
135 // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
136 // the first hardware serial port whose RX/TX pins are not dedicated to another use.
138 // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
140 // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
142 // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
144 // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
146 // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
147 // pins are NOT connected to anything by default.
148 #define SERIAL_PORT_MONITOR Serial
149 #define SERIAL_PORT_HARDWARE Serial1
152 #endif /* _VARIANT_ARDUINO_STM32_ */