Skip to content

Commit fbb420f

Browse files
darkspr1tefpistm
andcommittedAug 28, 2019
Added Generic flight controllers menu
with Afroflight Rev 5 boards Co-Authored-By: Frederic.Pillon <[email protected]> Signed-off-by: darkspr1te <[email protected]>
1 parent 5bb50be commit fbb420f

File tree

6 files changed

+895
-0
lines changed

6 files changed

+895
-0
lines changed
 

‎boards.txt

+118
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,77 @@ RAK.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg
11511151
3dprinter.menu.upload_method.dfuMethod.upload.options=-g
11521152
3dprinter.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg
11531153

1154+
1155+
###############################
1156+
# Genericflight Flight Controllers
1157+
1158+
Genericflight.name=Generic flight controllers
1159+
1160+
Genericflight.build.vid=0x0483
1161+
Genericflight.build.core=arduino
1162+
Genericflight.build.board=Genericflight
1163+
Genericflight.build.mcu=cortex-m3
1164+
Genericflight.build.series=STM32F1xx
1165+
Genericflight.build.cmsis_lib_gcc=arm_cortexM3l_math
1166+
Genericflight.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags}
1167+
1168+
# AfroFlight Rev5
1169+
Genericflight.menu.pnum.AFROFLIGHT_F103CB=Afro Flight Rev5 (8MHz)
1170+
Genericflight.menu.pnum.AFROFLIGHT_F103CB.upload.maximum_size=131072
1171+
Genericflight.menu.pnum.AFROFLIGHT_F103CB.upload.maximum_data_size=20480
1172+
Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.board=AFROFLIGHT_F103CB
1173+
Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.product_line=STM32F103xB
1174+
Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.variant=AFROFLIGHT_F103CB
1175+
1176+
Genericflight.menu.pnum.AFROFLIGHT_F103CB_12M=Afro Flight Rev5 (12MHz)
1177+
Genericflight.menu.pnum.AFROFLIGHT_F103CB_12M.upload.maximum_size=131072
1178+
Genericflight.menu.pnum.AFROFLIGHT_F103CB_12M.upload.maximum_data_size=20480
1179+
Genericflight.menu.pnum.AFROFLIGHT_F103CB_12M.build.board=AFROFLIGHT_F103CB_12M
1180+
Genericflight.menu.pnum.AFROFLIGHT_F103CB_12M.build.product_line=STM32F103xB
1181+
Genericflight.menu.pnum.AFROFLIGHT_F103CB_12M.build.variant=AFROFLIGHT_F103CB
1182+
1183+
# Upload menu
1184+
Genericflight.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
1185+
Genericflight.menu.upload_method.swdMethod.upload.protocol=0
1186+
Genericflight.menu.upload_method.swdMethod.upload.options=-g
1187+
Genericflight.menu.upload_method.swdMethod.upload.tool=stm32CubeProg
1188+
1189+
Genericflight.menu.upload_method.serialMethod=STM32CubeProgrammer (Serial)
1190+
Genericflight.menu.upload_method.serialMethod.upload.protocol=1
1191+
Genericflight.menu.upload_method.serialMethod.upload.options={serial.port.file} -s
1192+
Genericflight.menu.upload_method.serialMethod.upload.tool=stm32CubeProg
1193+
1194+
Genericflight.menu.upload_method.dfuMethod=STM32CubeProgrammer (DFU)
1195+
Genericflight.menu.upload_method.dfuMethod.upload.protocol=2
1196+
Genericflight.menu.upload_method.dfuMethod.upload.options=-g
1197+
Genericflight.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg
1198+
1199+
Genericflight.menu.upload_method.bmpMethod=BMP (Black Magic Probe)
1200+
Genericflight.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp
1201+
Genericflight.menu.upload_method.bmpMethod.upload.tool=bmp_upload
1202+
1203+
Genericflight.menu.upload_method.hidMethod=HID Bootloader 2.2
1204+
Genericflight.menu.upload_method.hidMethod.upload.protocol=hid22
1205+
Genericflight.menu.upload_method.hidMethod.upload.tool=hid_upload
1206+
Genericflight.menu.upload_method.hidMethod.build.flash_offset=0x800
1207+
Genericflight.menu.upload_method.hidMethod.build.bootloader_flags=-DBL_HID -DVECT_TAB_OFFSET={build.flash_offset}
1208+
1209+
Genericflight.menu.upload_method.dfu2Method=Maple DFU Bootloader 2.0
1210+
Genericflight.menu.upload_method.dfu2Method.upload.protocol=maple
1211+
Genericflight.menu.upload_method.dfu2Method.upload.tool=maple_upload
1212+
Genericflight.menu.upload_method.dfu2Method.upload.usbID=1EAF:0003
1213+
Genericflight.menu.upload_method.dfu2Method.upload.altID=2
1214+
Genericflight.menu.upload_method.dfu2Method.build.flash_offset=0x2000
1215+
Genericflight.menu.upload_method.dfu2Method.build.bootloader_flags=-DBL_LEGACY_LEAF -DVECT_TAB_OFFSET={build.flash_offset}
1216+
1217+
Genericflight.menu.upload_method.dfuoMethod=Maple DFU Bootloader original
1218+
Genericflight.menu.upload_method.dfuoMethod.upload.protocol=maple
1219+
Genericflight.menu.upload_method.dfuoMethod.upload.tool=maple_upload
1220+
Genericflight.menu.upload_method.dfuoMethod.upload.usbID=1EAF:0003
1221+
Genericflight.menu.upload_method.dfuoMethod.upload.altID=1
1222+
Genericflight.menu.upload_method.dfuoMethod.build.flash_offset=0x5000
1223+
Genericflight.menu.upload_method.dfuoMethod.build.bootloader_flags=-DBL_LEGACY_LEAF -DVECT_TAB_OFFSET={build.flash_offset}
1224+
11541225
################################################################################
11551226
# Midatronics boards
11561227

@@ -1267,6 +1338,12 @@ RAK.menu.xserial.disabled.build.xSerial=
12671338
3dprinter.menu.xserial.disabled=Disabled (no Serial support)
12681339
3dprinter.menu.xserial.disabled.build.xSerial=
12691340

1341+
Genericflight.menu.xserial.generic=Enabled (generic 'Serial')
1342+
Genericflight.menu.xserial.none=Enabled (no generic 'Serial')
1343+
Genericflight.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
1344+
Genericflight.menu.xserial.disabled=Disabled (no Serial support)
1345+
Genericflight.menu.xserial.disabled.build.xSerial=
1346+
12701347
Midatronics.menu.xserial.generic=Enabled (generic 'Serial')
12711348
Midatronics.menu.xserial.none=Enabled (no generic 'Serial')
12721349
Midatronics.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE
@@ -1400,6 +1477,19 @@ Sparky.menu.xusb.HSFS.build.usb_speed=-DUSE_USB_HS -DUSE_USB_HS_IN_FS
14001477
3dprinter.menu.xusb.HSFS=High Speed in Full Speed mode
14011478
3dprinter.menu.xusb.HSFS.build.usb_speed=-DUSE_USB_HS -DUSE_USB_HS_IN_FS
14021479

1480+
Genericflight.menu.usb.none=None
1481+
Genericflight.menu.usb.CDCgen=CDC (generic 'Serial' supersede U(S)ART)
1482+
Genericflight.menu.usb.CDCgen.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC
1483+
Genericflight.menu.usb.CDC=CDC (no generic 'Serial')
1484+
Genericflight.menu.usb.CDC.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB
1485+
Genericflight.menu.usb.HID=HID (keyboard and mouse)
1486+
Genericflight.menu.usb.HID.build.enable_usb={build.usb_flags} -DUSBD_USE_HID_COMPOSITE
1487+
Genericflight.menu.xusb.FS=Low/Full Speed
1488+
Genericflight.menu.xusb.HS=High Speed
1489+
Genericflight.menu.xusb.HS.build.usb_speed=-DUSE_USB_HS
1490+
Genericflight.menu.xusb.HSFS=High Speed in Full Speed mode
1491+
Genericflight.menu.xusb.HSFS.build.usb_speed=-DUSE_USB_HS -DUSE_USB_HS_IN_FS
1492+
14031493
Midatronics.menu.usb.none=None
14041494
Midatronics.menu.usb.CDCgen=CDC (generic 'Serial' supersede U(S)ART)
14051495
Midatronics.menu.usb.CDCgen.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC
@@ -1632,6 +1722,24 @@ RAK.menu.opt.ogstd.build.flags.optimize=-g -Og
16321722
3dprinter.menu.opt.ogstd=Debug (-g)
16331723
3dprinter.menu.opt.ogstd.build.flags.optimize=-g -Og
16341724

1725+
Genericflight.menu.opt.osstd=Smallest (-Os default)
1726+
Genericflight.menu.opt.oslto=Smallest (-Os) with LTO
1727+
Genericflight.menu.opt.oslto.build.flags.optimize=-Os -flto
1728+
Genericflight.menu.opt.o1std=Fast (-O1)
1729+
Genericflight.menu.opt.o1std.build.flags.optimize=-O1
1730+
Genericflight.menu.opt.o1lto=Fast (-O1) with LTO
1731+
Genericflight.menu.opt.o1lto.build.flags.optimize=-O1 -flto
1732+
Genericflight.menu.opt.o2std=Faster (-O2)
1733+
Genericflight.menu.opt.o2std.build.flags.optimize=-O2
1734+
Genericflight.menu.opt.o2lto=Faster (-O2) with LTO
1735+
Genericflight.menu.opt.o2lto.build.flags.optimize=-O2 -flto
1736+
Genericflight.menu.opt.o3std=Fastest (-O3)
1737+
Genericflight.menu.opt.o3std.build.flags.optimize=-O3
1738+
Genericflight.menu.opt.o3lto=Fastest (-O3) with LTO
1739+
Genericflight.menu.opt.o3lto.build.flags.optimize=-O3 -flto
1740+
Genericflight.menu.opt.ogstd=Debug (-g)
1741+
Genericflight.menu.opt.ogstd.build.flags.optimize=-g -Og
1742+
16351743
Midatronics.menu.opt.osstd=Smallest (-Os default)
16361744
Midatronics.menu.opt.oslto=Smallest (-Os) with LTO
16371745
Midatronics.menu.opt.oslto.build.flags.optimize=-Os -flto
@@ -1771,6 +1879,16 @@ RAK.menu.rtlib.full.build.flags.ldspecs=
17711879
3dprinter.menu.rtlib.full=Newlib Standard
17721880
3dprinter.menu.rtlib.full.build.flags.ldspecs=
17731881

1882+
Genericflight.menu.rtlib.nano=Newlib Nano (default)
1883+
Genericflight.menu.rtlib.nanofp=Newlib Nano + Float Printf
1884+
Genericflight.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float
1885+
Genericflight.menu.rtlib.nanofs=Newlib Nano + Float Scanf
1886+
Genericflight.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs -u _scanf_float
1887+
Genericflight.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
1888+
Genericflight.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float -u _scanf_float
1889+
Genericflight.menu.rtlib.full=Newlib Standard
1890+
Genericflight.menu.rtlib.full.build.flags.ldspecs=
1891+
17741892
Midatronics.menu.rtlib.nano=Newlib Nano (default)
17751893
Midatronics.menu.rtlib.nanofp=Newlib Nano + Float Printf
17761894
Midatronics.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float
+254
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2019, 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+
* Automatically generated from STM32F103C(4-6)|(8-B)Tx.xml
30+
*/
31+
#include "Arduino.h"
32+
#include "PeripheralPins.h"
33+
34+
/* =====
35+
* Note: Commented lines are alternative possibilities which are not used per default.
36+
* If you change them, you will have to know what you do
37+
* =====
38+
*/
39+
40+
//*** ADC ***
41+
42+
#ifdef HAL_ADC_MODULE_ENABLED
43+
WEAK const PinMap PinMap_ADC[] = {
44+
{PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0
45+
// {PA_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0
46+
{PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1
47+
// {PA_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1
48+
{PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2
49+
// {PA_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2
50+
{PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
51+
// {PA_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3
52+
{PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
53+
// {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4
54+
{PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5
55+
// {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5
56+
{PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
57+
// {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6
58+
{PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7
59+
// {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7
60+
{PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
61+
// {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8
62+
{PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9
63+
// {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9
64+
{NC, NP, 0}
65+
};
66+
#endif
67+
68+
//*** No DAC ***
69+
70+
//*** I2C ***
71+
72+
#ifdef HAL_I2C_MODULE_ENABLED
73+
WEAK const PinMap PinMap_I2C_SDA[] = {
74+
{PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
75+
{PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_I2C1_ENABLE)},
76+
{PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
77+
{NC, NP, 0}
78+
};
79+
#endif
80+
81+
#ifdef HAL_I2C_MODULE_ENABLED
82+
WEAK const PinMap PinMap_I2C_SCL[] = {
83+
{PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
84+
{PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_I2C1_ENABLE)},
85+
{PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
86+
{NC, NP, 0}
87+
};
88+
#endif
89+
90+
//*** PWM ***
91+
92+
#ifdef HAL_TIM_MODULE_ENABLED
93+
WEAK const PinMap PinMap_PWM[] = {
94+
{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM2_CH1
95+
// {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_2, 1, 0)}, // TIM2_CH1
96+
{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM2_CH2
97+
// {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_2, 2, 0)}, // TIM2_CH2
98+
{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM2_CH3
99+
// {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 3, 0)}, // TIM2_CH3
100+
{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM2_CH4
101+
// {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 4, 0)}, // TIM2_CH4
102+
{PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM3_CH1
103+
// {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 1, 1)}, // TIM1_CH1N
104+
{PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM3_CH2
105+
{PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM1_CH1
106+
// {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 1, 0)}, // TIM1_CH1
107+
{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM1_CH2
108+
// {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 2, 0)}, // TIM1_CH2
109+
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM1_CH3
110+
// {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 3, 0)}, // TIM1_CH3
111+
{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM1_CH4
112+
// {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 4, 0)}, // TIM1_CH4
113+
// {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 1, 0)}, // TIM2_CH1
114+
{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 1, 0)}, // TIM2_CH1
115+
// {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 2, 1)}, // TIM1_CH2N
116+
{PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM3_CH3
117+
// {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 3, 0)}, // TIM3_CH3
118+
// {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM1_PARTIAL, 3, 1)}, // TIM1_CH3N
119+
{PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM3_CH4
120+
// {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 4, 0)}, // TIM3_CH4
121+
// {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_1, 2, 0)}, // TIM2_CH2
122+
{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 2, 0)}, // TIM2_CH2
123+
{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 1, 0)}, // TIM3_CH1
124+
{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 2, 0)}, // TIM3_CH2
125+
{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM4_CH1
126+
{PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM4_CH2
127+
{PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM4_CH3
128+
{PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 4, 0)}, // TIM4_CH4
129+
// {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_2, 3, 0)}, // TIM2_CH3
130+
{PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 3, 0)}, // TIM2_CH3
131+
// {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_PARTIAL_2, 4, 0)}, // TIM2_CH4
132+
{PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 4, 0)}, // TIM2_CH4
133+
{PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 1)}, // TIM1_CH1N
134+
{PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 1)}, // TIM1_CH2N
135+
{PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 1)}, // TIM1_CH3N
136+
{NC, NP, 0}
137+
};
138+
#endif
139+
140+
//*** SERIAL ***
141+
142+
#ifdef HAL_UART_MODULE_ENABLED
143+
WEAK const PinMap PinMap_UART_TX[] = {
144+
{PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
145+
{PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
146+
{PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART1_ENABLE)},
147+
{PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
148+
{NC, NP, 0}
149+
};
150+
#endif
151+
152+
#ifdef HAL_UART_MODULE_ENABLED
153+
WEAK const PinMap PinMap_UART_RX[] = {
154+
{PA_3, USART2, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
155+
{PA_10, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
156+
{PB_7, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_USART1_ENABLE)},
157+
{PB_11, USART3, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
158+
{NC, NP, 0}
159+
};
160+
#endif
161+
162+
#ifdef HAL_UART_MODULE_ENABLED
163+
WEAK const PinMap PinMap_UART_RTS[] = {
164+
{PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
165+
{PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
166+
{PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
167+
// {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART3_PARTIAL)},
168+
{NC, NP, 0}
169+
};
170+
#endif
171+
172+
#ifdef HAL_UART_MODULE_ENABLED
173+
WEAK const PinMap PinMap_UART_CTS[] = {
174+
{PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
175+
{PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
176+
{PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
177+
// {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART3_PARTIAL)},
178+
{NC, NP, 0}
179+
};
180+
#endif
181+
182+
//*** SPI ***
183+
184+
#ifdef HAL_SPI_MODULE_ENABLED
185+
WEAK const PinMap PinMap_SPI_MOSI[] = {
186+
{PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
187+
{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
188+
{PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
189+
{NC, NP, 0}
190+
};
191+
#endif
192+
193+
#ifdef HAL_SPI_MODULE_ENABLED
194+
WEAK const PinMap PinMap_SPI_MISO[] = {
195+
{PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
196+
{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
197+
{PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
198+
{NC, NP, 0}
199+
};
200+
#endif
201+
202+
#ifdef HAL_SPI_MODULE_ENABLED
203+
WEAK const PinMap PinMap_SPI_SCLK[] = {
204+
{PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
205+
{PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
206+
{PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
207+
{NC, NP, 0}
208+
};
209+
#endif
210+
211+
#ifdef HAL_SPI_MODULE_ENABLED
212+
WEAK const PinMap PinMap_SPI_SSEL[] = {
213+
{PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
214+
{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
215+
{PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
216+
{NC, NP, 0}
217+
};
218+
#endif
219+
220+
//*** CAN ***
221+
222+
#ifdef HAL_CAN_MODULE_ENABLED
223+
WEAK const PinMap PinMap_CAN_RD[] = {
224+
{PA_11, CAN1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)},
225+
{PB_8, CAN1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_CAN1_2)},
226+
{NC, NP, 0}
227+
};
228+
#endif
229+
230+
#ifdef HAL_CAN_MODULE_ENABLED
231+
WEAK const PinMap PinMap_CAN_TD[] = {
232+
{PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)},
233+
{PB_9, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_CAN1_2)},
234+
{NC, NP, 0}
235+
};
236+
#endif
237+
238+
//*** No ETHERNET ***
239+
240+
//*** No QUADSPI ***
241+
242+
//*** USB ***
243+
244+
#ifdef HAL_PCD_MODULE_ENABLED
245+
WEAK const PinMap PinMap_USB[] = {
246+
{PA_11, USB, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, // USB_DM
247+
{PA_12, USB, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, // USB_DP
248+
{NC, NP, 0}
249+
};
250+
#endif
251+
252+
//*** No USB_OTG_FS ***
253+
254+
//*** No USB_OTG_HS ***
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* SYS_WKUP */
2+
#ifdef PWR_WAKEUP_PIN1
3+
SYS_WKUP1 = PA_0,
4+
#endif
5+
#ifdef PWR_WAKEUP_PIN2
6+
SYS_WKUP2 = NC,
7+
#endif
8+
#ifdef PWR_WAKEUP_PIN3
9+
SYS_WKUP3 = NC,
10+
#endif
11+
#ifdef PWR_WAKEUP_PIN4
12+
SYS_WKUP4 = NC,
13+
#endif
14+
#ifdef PWR_WAKEUP_PIN5
15+
SYS_WKUP5 = NC,
16+
#endif
17+
#ifdef PWR_WAKEUP_PIN6
18+
SYS_WKUP6 = NC,
19+
#endif
20+
#ifdef PWR_WAKEUP_PIN7
21+
SYS_WKUP7 = NC,
22+
#endif
23+
#ifdef PWR_WAKEUP_PIN8
24+
SYS_WKUP8 = NC,
25+
#endif
26+
/* USB */
27+
#ifdef USBCON
28+
USB_DM = PA_11,
29+
USB_DP = PA_12,
30+
#endif
+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
/*
2+
*****************************************************************************
3+
**
4+
5+
** File : ldscript.ld
6+
**
7+
** Abstract : Linker script for STM32F103C(8-B)Tx Device with
8+
** 32/64/128KByte FLASH, 10/20KByte RAM
9+
**
10+
** Set heap size, stack size and stack location according
11+
** to application requirements.
12+
**
13+
** Set memory bank area and size if external memory is used.
14+
**
15+
** Target : STMicroelectronics STM32
16+
**
17+
**
18+
** Distribution: The file is distributed as is, without any warranty
19+
** of any kind.
20+
**
21+
*****************************************************************************
22+
** @attention
23+
**
24+
** <h2><center>&copy; COPYRIGHT(c) 2014 Ac6</center></h2>
25+
**
26+
** Redistribution and use in source and binary forms, with or without modification,
27+
** are permitted provided that the following conditions are met:
28+
** 1. Redistributions of source code must retain the above copyright notice,
29+
** this list of conditions and the following disclaimer.
30+
** 2. Redistributions in binary form must reproduce the above copyright notice,
31+
** this list of conditions and the following disclaimer in the documentation
32+
** and/or other materials provided with the distribution.
33+
** 3. Neither the name of Ac6 nor the names of its contributors
34+
** may be used to endorse or promote products derived from this software
35+
** without specific prior written permission.
36+
**
37+
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38+
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39+
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40+
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
41+
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42+
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43+
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
44+
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45+
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46+
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47+
**
48+
*****************************************************************************
49+
*/
50+
51+
/* Entry Point */
52+
ENTRY(Reset_Handler)
53+
54+
/* Highest address of the user mode stack */
55+
_estack = 0x20000000 + LD_MAX_DATA_SIZE; /* end of RAM */
56+
/* Generate a link error if heap and stack don't fit into RAM */
57+
_Min_Heap_Size = 0x200; /* required amount of heap */
58+
_Min_Stack_Size = 0x400; /* required amount of stack */
59+
60+
/* Specify the memory areas */
61+
MEMORY
62+
{
63+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
64+
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
65+
}
66+
67+
/* Define output sections */
68+
SECTIONS
69+
{
70+
/* The startup code goes first into FLASH */
71+
.isr_vector :
72+
{
73+
. = ALIGN(4);
74+
KEEP(*(.isr_vector)) /* Startup code */
75+
. = ALIGN(4);
76+
} >FLASH
77+
78+
/* The program code and other data goes into FLASH */
79+
.text ALIGN(4):
80+
{
81+
. = ALIGN(4);
82+
*(.text) /* .text sections (code) */
83+
*(.text*) /* .text* sections (code) */
84+
*(.glue_7) /* glue arm to thumb code */
85+
*(.glue_7t) /* glue thumb to arm code */
86+
*(.eh_frame)
87+
88+
KEEP (*(.init))
89+
KEEP (*(.fini))
90+
91+
. = ALIGN(4);
92+
_etext = .; /* define a global symbols at end of code */
93+
} >FLASH
94+
95+
/* Constant data goes into FLASH */
96+
.rodata :
97+
{
98+
. = ALIGN(4);
99+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
100+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
101+
. = ALIGN(4);
102+
} >FLASH
103+
104+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
105+
.ARM : {
106+
__exidx_start = .;
107+
*(.ARM.exidx*)
108+
__exidx_end = .;
109+
} >FLASH
110+
111+
.preinit_array :
112+
{
113+
PROVIDE_HIDDEN (__preinit_array_start = .);
114+
KEEP (*(.preinit_array*))
115+
PROVIDE_HIDDEN (__preinit_array_end = .);
116+
} >FLASH
117+
.init_array :
118+
{
119+
PROVIDE_HIDDEN (__init_array_start = .);
120+
KEEP (*(SORT(.init_array.*)))
121+
KEEP (*(.init_array*))
122+
PROVIDE_HIDDEN (__init_array_end = .);
123+
} >FLASH
124+
.fini_array :
125+
{
126+
PROVIDE_HIDDEN (__fini_array_start = .);
127+
KEEP (*(SORT(.fini_array.*)))
128+
KEEP (*(.fini_array*))
129+
PROVIDE_HIDDEN (__fini_array_end = .);
130+
} >FLASH
131+
132+
/* used by the startup to initialize data */
133+
_sidata = LOADADDR(.data);
134+
135+
/* Initialized data sections goes into RAM, load LMA copy after code */
136+
.data :
137+
{
138+
. = ALIGN(4);
139+
_sdata = .; /* create a global symbol at data start */
140+
*(.data) /* .data sections */
141+
*(.data*) /* .data* sections */
142+
143+
. = ALIGN(4);
144+
_edata = .; /* define a global symbol at data end */
145+
} >RAM AT> FLASH
146+
147+
148+
/* Uninitialized data section */
149+
. = ALIGN(4);
150+
.bss :
151+
{
152+
/* This is used by the startup in order to initialize the .bss secion */
153+
_sbss = .; /* define a global symbol at bss start */
154+
__bss_start__ = _sbss;
155+
*(.bss)
156+
*(.bss*)
157+
*(COMMON)
158+
159+
. = ALIGN(4);
160+
_ebss = .; /* define a global symbol at bss end */
161+
__bss_end__ = _ebss;
162+
} >RAM
163+
164+
/* User_heap_stack section, used to check that there is enough RAM left */
165+
._user_heap_stack :
166+
{
167+
. = ALIGN(8);
168+
PROVIDE ( end = . );
169+
PROVIDE ( _end = . );
170+
. = . + _Min_Heap_Size;
171+
. = . + _Min_Stack_Size;
172+
. = ALIGN(8);
173+
} >RAM
174+
175+
176+
177+
/* Remove information from the standard libraries */
178+
/DISCARD/ :
179+
{
180+
libc.a ( * )
181+
libm.a ( * )
182+
libgcc.a ( * )
183+
}
184+
185+
.ARM.attributes 0 : { *(.ARM.attributes) }
186+
}
187+
188+
+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2018, 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+
#include "pins_arduino.h"
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
// Pin number
37+
const PinName digitalPin[] = {
38+
PB_9, //D0
39+
PB_8, //D1
40+
PB_7, //D2
41+
PB_6, //D3
42+
PB_5, //D4
43+
PB_4, //D5
44+
PB_3, //D6
45+
PA_15, //D7
46+
PA_12, //D8
47+
PA_11, //D9
48+
PA_10, //D10
49+
PA_9, //D11
50+
PA_8, //D12
51+
PB_15, //D13
52+
PB_14, //D14
53+
PB_13, //D15
54+
PB_12, //D16
55+
PC_13, //D17
56+
PC_14, //D18
57+
PC_15, //D19
58+
PA_0, //D20/A0
59+
PA_1, //D21/A1
60+
PA_2, //D22/A2
61+
PA_3, //D23/A3
62+
PA_4, //D24/A4
63+
PA_5, //D25/A5
64+
PA_6, //D26/A6
65+
PA_7, //D27/A7
66+
PB_0, //D28/A8
67+
PB_1, //D29/A9
68+
PB_10, //D30
69+
PB_11, //D31
70+
PB_2, //D32 - BOOT1
71+
PA_13, //D33 - SWDI0
72+
PA_14, //D34 - SWCLK
73+
};
74+
75+
#ifdef __cplusplus
76+
}
77+
#endif
78+
79+
// ----------------------------------------------------------------------------
80+
81+
#ifdef __cplusplus
82+
extern "C" {
83+
#endif
84+
85+
/**
86+
* @brief System Clock Configuration
87+
* @param None
88+
* @retval None
89+
*/
90+
WEAK void SystemClock_Config(void)
91+
{
92+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
93+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
94+
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
95+
96+
/* Initializes the CPU, AHB and APB busses clocks */
97+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
98+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
99+
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
100+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
101+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
102+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
103+
#ifdef ARDUINO_AFROFLIGHT_F103CB_12M
104+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
105+
#else /* 8 MHz */
106+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
107+
#endif
108+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
109+
Error_Handler();
110+
}
111+
/* Initializes the CPU, AHB and APB busses clocks */
112+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
113+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
114+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
115+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
116+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
117+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
118+
119+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
120+
Error_Handler();
121+
}
122+
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
123+
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
124+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
125+
Error_Handler();
126+
}
127+
}
128+
#ifdef __cplusplus
129+
}
130+
#endif

‎variants/AFROFLIGHT_F103CB/variant.h

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2018, 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 _VARIANT_ARDUINO_STM32_
31+
#define _VARIANT_ARDUINO_STM32_
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif // __cplusplus
36+
37+
/*----------------------------------------------------------------------------
38+
* Pins
39+
*----------------------------------------------------------------------------*/
40+
41+
#define PB9 0
42+
#define PB8 1
43+
#define PB7 2
44+
#define PB6 3
45+
#define PB5 4
46+
#define PB4 5 // LED0
47+
#define PB3 6 // LED1
48+
#define PA15 7
49+
#define PA12 8
50+
#define PA11 9
51+
#define PA10 10
52+
#define PA9 11
53+
#define PA8 12
54+
#define PB15 13
55+
#define PB14 14
56+
#define PB13 15
57+
#define PB12 16
58+
#define PC13 17
59+
#define PC14 18
60+
#define PC15 19
61+
#define PA0 20 // A0
62+
#define PA1 21 // A1
63+
#define PA2 22 // A2
64+
#define PA3 23 // A3
65+
#define PA4 24 // A4 Board voltage ADC
66+
#define PA5 25 // A5
67+
#define PA6 26 // A6
68+
#define PA7 27 // A7
69+
#define PB0 28 // A8
70+
#define PB1 29 // A9
71+
#define PB10 30
72+
#define PB11 31
73+
// Other
74+
#define PB2 32 // BOOT1
75+
#define PA13 33 // SWDI0
76+
#define PA14 34 // SWCLK
77+
78+
// This must be a literal
79+
#define NUM_DIGITAL_PINS 35
80+
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
81+
#define NUM_ANALOG_INPUTS 10
82+
#define NUM_ANALOG_FIRST 20
83+
84+
// On-board LED pin number
85+
#define LED0 PB4
86+
#define LED1 PB3
87+
88+
#define LED_BUILTIN LED0
89+
90+
// SPI Definitions
91+
#define PIN_SPI_SS PA4
92+
#define PIN_SPI_MOSI PA7
93+
#define PIN_SPI_MISO PA6
94+
#define PIN_SPI_SCK PA5
95+
96+
// I2C Definitions
97+
//On afroflight Rev 5 it's on i2c port 2 that MPU6050 is connected too
98+
#define PIN_WIRE_SDA PB11
99+
#define PIN_WIRE_SCL PB10
100+
101+
// Timer Definitions
102+
#define TIMER_TONE TIM3
103+
#define TIMER_SERVO TIM2
104+
105+
// UART Definitions
106+
#define SERIAL_UART_INSTANCE 1
107+
// Default pin used for 'Serial' instance
108+
// Mandatory for Firmata
109+
#define PIN_SERIAL_RX PA10
110+
#define PIN_SERIAL_TX PA9
111+
112+
#define MPU_I2C_SDA PB11
113+
#define MPU_I2C_SCL PB10
114+
#define MPU_ADDR 0x68
115+
#define MPU_INT PB13
116+
/*
117+
* RC_CH1 T2C1 PA0
118+
* RC_CH2 T2C2 PA1
119+
* RC_CH3 T2C3/UA2_TX PA2
120+
* RC_CH4 T2C4/UA2_RX PA3
121+
* RC_CH5 T3C1 PA6
122+
* RC_CH6 T3C2 PA7
123+
* RC_CH7 T3C3 PB0
124+
* RC_CH8 T3C4 PB1
125+
*
126+
* PWM1 T1C1 PA8
127+
* PMW2 T1C4 PA11
128+
* PMW3 T4C1 PB6
129+
* PMW4 T4C2 PB7
130+
* PMW5 T4C3 PB8
131+
* PMW6 T4C4 PB9
132+
* SONAR_INT PA15
133+
* GPIO_BOTTOM PB5
134+
* TELEM_OUT PA13 // Warning, SWD access is lost when using this pin, bootloader via uart is required after
135+
*
136+
* BAT_ADC PA4 // Connected to 6 pin header Battery voltage in via resistor divider
137+
* ACC_INT PA5 // Connected to Intterupt pin of MMA84520 accelerometer I2C
138+
*
139+
* MAG_DRD PB12 //Connected to HMC5883L compass I2C
140+
* BEEP PA12 //Connected to Beep out transistor on 6 pin header
141+
*
142+
*/
143+
144+
#ifdef ARDUINO_AFROFLIGHT_F103CB_12M
145+
#define HSE_VALUE 12000000U /*!< Value of the External oscillator in Hz */
146+
#endif
147+
148+
#ifdef __cplusplus
149+
} // extern "C"
150+
#endif
151+
/*----------------------------------------------------------------------------
152+
* Arduino objects - C++ only
153+
*----------------------------------------------------------------------------*/
154+
155+
#ifdef __cplusplus
156+
// These serial port names are intended to allow libraries and architecture-neutral
157+
// sketches to automatically default to the correct port name for a particular type
158+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
159+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
160+
//
161+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
162+
//
163+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
164+
//
165+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
166+
//
167+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
168+
//
169+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
170+
// pins are NOT connected to anything by default.
171+
#define SERIAL_PORT_MONITOR Serial
172+
#define SERIAL_PORT_HARDWARE Serial1
173+
#endif
174+
175+
#endif /* _VARIANT_ARDUINO_STM32_ */

0 commit comments

Comments
 (0)
Please sign in to comment.