Skip to content

Commit ec9ab0e

Browse files
authored
Merge pull request #1 from fpistm/pr/573
Clean up
2 parents d700d4c + 66b821b commit ec9ab0e

File tree

4 files changed

+43
-97
lines changed

4 files changed

+43
-97
lines changed

boards.txt

-6
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,6 @@ RAK.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg
11081108

11091109
Genericflight.name=Generic flight controllers
11101110

1111-
11121111
Genericflight.build.vid=0x0483
11131112
Genericflight.build.core=arduino
11141113
Genericflight.build.board=Genericflight
@@ -1117,8 +1116,6 @@ Genericflight.build.series=STM32F1xx
11171116
Genericflight.build.cmsis_lib_gcc=arm_cortexM3l_math
11181117
Genericflight.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags}
11191118

1120-
1121-
11221119
# AfroFlight Rev5
11231120
Genericflight.menu.pnum.AFROFLIGHT_F103CB=Afro Flight Rev5
11241121
Genericflight.menu.pnum.AFROFLIGHT_F103CB.upload.maximum_size=131072
@@ -1128,10 +1125,7 @@ Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.series=STM32F1xx
11281125
Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.product_line=STM32F103xB
11291126
Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.variant=AFROFLIGHT_F103CB
11301127

1131-
1132-
11331128
# Upload menu
1134-
11351129
Genericflight.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
11361130
Genericflight.menu.upload_method.swdMethod.upload.protocol=0
11371131
Genericflight.menu.upload_method.swdMethod.upload.options=-g

variants/AFROFLIGHT_F103CB/PeripheralPins.c

-20
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ WEAK const PinMap PinMap_ADC[] = {
7373
WEAK const PinMap PinMap_I2C_SDA[] = {
7474
{PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
7575
{PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_I2C1_ENABLE)},
76-
#ifndef ARDUINO_BLUEPILL_F103C6
7776
{PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
78-
#endif
7977
{NC, NP, 0}
8078
};
8179
#endif
@@ -84,9 +82,7 @@ WEAK const PinMap PinMap_I2C_SDA[] = {
8482
WEAK const PinMap PinMap_I2C_SCL[] = {
8583
{PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
8684
{PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_I2C1_ENABLE)},
87-
#ifndef ARDUINO_BLUEPILL_F103C6
8885
{PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)},
89-
#endif
9086
{NC, NP, 0}
9187
};
9288
#endif
@@ -126,7 +122,6 @@ WEAK const PinMap PinMap_PWM[] = {
126122
{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 2, 0)}, // TIM2_CH2
127123
{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 1, 0)}, // TIM3_CH1
128124
{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 2, 0)}, // TIM3_CH2
129-
#ifndef ARDUINO_BLUEPILL_F103C6
130125
{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM4_CH1
131126
{PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM4_CH2
132127
{PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM4_CH3
@@ -150,7 +145,6 @@ WEAK const PinMap PinMap_UART_TX[] = {
150145
{PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
151146
{PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART1_ENABLE)},
152147
{PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
153-
#endif
154148
{NC, NP, 0}
155149
};
156150
#endif
@@ -160,9 +154,7 @@ WEAK const PinMap PinMap_UART_RX[] = {
160154
{PA_3, USART2, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
161155
{PA_10, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
162156
{PB_7, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_USART1_ENABLE)},
163-
#ifndef ARDUINO_BLUEPILL_F103C6
164157
{PB_11, USART3, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)},
165-
#endif
166158
{NC, NP, 0}
167159
};
168160
#endif
@@ -171,10 +163,8 @@ WEAK const PinMap PinMap_UART_RX[] = {
171163
WEAK const PinMap PinMap_UART_RTS[] = {
172164
{PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
173165
{PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
174-
#ifndef ARDUINO_BLUEPILL_F103C6
175166
{PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
176167
// {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART3_PARTIAL)},
177-
#endif
178168
{NC, NP, 0}
179169
};
180170
#endif
@@ -183,10 +173,8 @@ WEAK const PinMap PinMap_UART_RTS[] = {
183173
WEAK const PinMap PinMap_UART_CTS[] = {
184174
{PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
185175
{PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
186-
#ifndef ARDUINO_BLUEPILL_F103C6
187176
{PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
188177
// {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART3_PARTIAL)},
189-
#endif
190178
{NC, NP, 0}
191179
};
192180
#endif
@@ -197,9 +185,7 @@ WEAK const PinMap PinMap_UART_CTS[] = {
197185
WEAK const PinMap PinMap_SPI_MOSI[] = {
198186
{PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
199187
{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
200-
#ifndef ARDUINO_BLUEPILL_F103C6
201188
{PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
202-
#endif
203189
{NC, NP, 0}
204190
};
205191
#endif
@@ -208,9 +194,7 @@ WEAK const PinMap PinMap_SPI_MOSI[] = {
208194
WEAK const PinMap PinMap_SPI_MISO[] = {
209195
{PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
210196
{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
211-
#ifndef ARDUINO_BLUEPILL_F103C6
212197
{PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
213-
#endif
214198
{NC, NP, 0}
215199
};
216200
#endif
@@ -219,9 +203,7 @@ WEAK const PinMap PinMap_SPI_MISO[] = {
219203
WEAK const PinMap PinMap_SPI_SCLK[] = {
220204
{PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
221205
{PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
222-
#ifndef ARDUINO_BLUEPILL_F103C6
223206
{PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
224-
#endif
225207
{NC, NP, 0}
226208
};
227209
#endif
@@ -230,9 +212,7 @@ WEAK const PinMap PinMap_SPI_SCLK[] = {
230212
WEAK const PinMap PinMap_SPI_SSEL[] = {
231213
{PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
232214
{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)},
233-
#ifndef ARDUINO_BLUEPILL_F103C6
234215
{PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)},
235-
#endif
236216
{NC, NP, 0}
237217
};
238218
#endif

variants/AFROFLIGHT_F103CB/variant.cpp

+5-20
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ extern "C" {
3535

3636
// Pin number
3737
const PinName digitalPin[] = {
38-
/* USB connector on the top, MCU side */
39-
/* Left Side */
4038
PB_9, //D0
4139
PB_8, //D1
4240
PB_7, //D2
@@ -45,17 +43,16 @@ const PinName digitalPin[] = {
4543
PB_4, //D5
4644
PB_3, //D6
4745
PA_15, //D7
48-
PA_12, //D8 - USB DP
49-
PA_11, //D9 - USB DM
46+
PA_12, //D8
47+
PA_11, //D9
5048
PA_10, //D10
5149
PA_9, //D11
5250
PA_8, //D12
5351
PB_15, //D13
5452
PB_14, //D14
5553
PB_13, //D15
56-
PB_12, //D16 - LED Blackpill
57-
/* Right side */
58-
PC_13, //D17 - LED Bluepill
54+
PB_12, //D16
55+
PC_13, //D17
5956
PC_14, //D18
6057
PC_15, //D19
6158
PA_0, //D20/A0
@@ -87,24 +84,12 @@ extern "C" {
8784

8885
/**
8986
* @brief System Clock Configuration
90-
* The system Clock is configured as follow :
91-
* System Clock source = PLL (HSE)
92-
* SYSCLK(Hz) = 72000000
93-
* HCLK(Hz) = 72000000
94-
* AHB Prescaler = 1
95-
* APB1 Prescaler = 2
96-
* APB2 Prescaler = 1
97-
* PLL_Source = HSE
98-
* PLL_Mul = 9
99-
* Flash Latency(WS) = 2
100-
* ADC Prescaler = 6
101-
* USB Prescaler = 1.5
10287
* @param None
10388
* @retval None
10489
*/
10590
WEAK void SystemClock_Config(void)
10691
{
107-
//Board has 12mhz xtal, iám currenlty using HSI internal xtal , i've not figured settings for external 12mhz
92+
// Board has external 12MHz Xtal, currenlty using HSI internal Xtal
10893
RCC_OscInitTypeDef RCC_OscInitStruct;
10994
RCC_ClkInitTypeDef RCC_ClkInitStruct;
11095
RCC_PeriphCLKInitTypeDef PeriphClkInit;

variants/AFROFLIGHT_F103CB/variant.h

+38-51
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,24 @@ extern "C" {
3838
* Pins
3939
*----------------------------------------------------------------------------*/
4040

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.
42-
// Left Side
4341
#define PB9 0
4442
#define PB8 1
4543
#define PB7 2
4644
#define PB6 3
4745
#define PB5 4
48-
#define PB4 5
49-
#define PB3 6
46+
#define PB4 5 // LED0
47+
#define PB3 6 // LED1
5048
#define PA15 7
51-
#define PA12 8 // USB DP
52-
#define PA11 9 // USB DM
49+
#define PA12 8
50+
#define PA11 9
5351
#define PA10 10
5452
#define PA9 11
5553
#define PA8 12
5654
#define PB15 13
5755
#define PB14 14
5856
#define PB13 15
59-
#define PB12 16 // LED Blackpill
60-
// Right side
61-
#define PC13 17 // LED Bluepill
57+
#define PB12 16
58+
#define PC13 17
6259
#define PC14 18
6360
#define PC15 19
6461
#define PA0 20 // A0
@@ -85,14 +82,10 @@ extern "C" {
8582
#define NUM_ANALOG_FIRST 20
8683

8784
// On-board LED pin number
88-
#ifdef ARDUINO_BLUEPILL_F103C8
89-
#define LED_BUILTIN PC13
90-
#else
91-
#define LED_BUILTIN PB4
92-
#endif
93-
#define LED_GREEN PB3
94-
#define LED_RED LED_BUILTIN
85+
#define LED0 PB4
86+
#define LED1 PB3
9587

88+
#define LED_BUILTIN LED0
9689

9790
// SPI Definitions
9891
#define PIN_SPI_SS PA4
@@ -101,19 +94,13 @@ extern "C" {
10194
#define PIN_SPI_SCK PA5
10295

10396
// I2C Definitions
104-
//#define PIN_WIRE_SDA PB7
105-
//#define PIN_WIRE_SCL PB6
10697
//On afroflight Rev 5 it's on i2c port 2 that MPU6050 is connected too
107-
#define PIN_WIRE_SDA PB11
108-
#define PIN_WIRE_SCL PB10
109-
98+
#define PIN_WIRE_SDA PB11
99+
#define PIN_WIRE_SCL PB10
110100

111101
// Timer Definitions
112-
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
113102
#define TIMER_TONE TIM3
114-
115-
// Do not use basic timer: OC is required
116-
#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work
103+
#define TIMER_SERVO TIM2
117104

118105
// UART Definitions
119106
#define SERIAL_UART_INSTANCE 1
@@ -122,38 +109,38 @@ extern "C" {
122109
#define PIN_SERIAL_RX PA10
123110
#define PIN_SERIAL_TX PA9
124111

125-
#define MPU_I2C_SDA PB11;
126-
#define MPU_I2C_SCL PB10;
127-
#define MPU_ADDR 0x68;
128-
#define MPU_INT PB13;
112+
#define MPU_I2C_SDA PB11
113+
#define MPU_I2C_SCL PB10
114+
#define MPU_ADDR 0x68
115+
#define MPU_INT PB13
129116
/*
130-
* RC_CH1 T2C1 PA0
131-
* RC_CH2 T2C2 PA1
132-
* RC_CH3 T2C3/UA2_TX PA2
133-
* RC_CH4 T2C4/UA2_RX PA3
134-
* RC_CH5 T3C1 PA6
135-
* RC_CH6 T3C2 PA7
136-
* RC_CH7 T3C3 PB0
137-
* RC_CH8 T3C4 PB1
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
138125
*
139-
* PWM1 T1C1 PA8
140-
* PMW2 T1C4 PA11
141-
* PMW3 T4C1 PB6
142-
* PMW4 T4C2 PB7
143-
* PMW5 T4C3 PB8
144-
* PMW6 T4C4 PB9
145-
* SONAR_INT PA15
146-
* GPIO_BOTTOM PB5
147-
* TELEM_OUT PA13 // Warning, SWD access is lost when using this pin, bootloader via uart is required after
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
148135
*
149-
* BAT_ADC PA4 // Connected to 6 pin header Battery voltage in via resistor divider
150-
* ACC_INT PA5 //Connected to Intterupt pin of MMA84520 accelerometer I2C
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
151138
*
152-
* MAG_DRD PB12; //Connected to HMC5883L compass I2C
153-
* BEEP PA12; //Connected to Beep out transistor on 6 pin header
139+
* MAG_DRD PB12 //Connected to HMC5883L compass I2C
140+
* BEEP PA12 //Connected to Beep out transistor on 6 pin header
154141
*
155142
*/
156-
143+
157144
#ifdef __cplusplus
158145
} // extern "C"
159146
#endif

0 commit comments

Comments
 (0)