Skip to content

Commit

Permalink
removed unsupported/unused STM32F103 references
Browse files Browse the repository at this point in the history
  • Loading branch information
FDSoftware committed Aug 2, 2024
1 parent 7c14269 commit 90334a4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 89 deletions.
10 changes: 0 additions & 10 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@ upload_protocol = dfu
debug_tool = stlink
monitor_speed = 115200

[env:bluepill_f103c8]
platform = ststm32
framework = arduino
; framework-arduinoststm32
board = bluepill_f103c8_128k
lib_deps = EEPROM, stm32duino/STM32duino RTC @ 1.2.0
;build_flags = -DUSE_LIBDIVIDE -fpermissive -std=gnu++11 -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-Map,output.map
build_flags = -DUSE_LIBDIVIDE -fpermissive -std=gnu++11 -Os -DCORE_STM32_OFFICIAL -UBOARD_MAX_IO_PINS

;SAMD21
[env:samd21]
platform = atmelsam
Expand Down Expand Up @@ -160,7 +151,6 @@ extra_configs = local.ini
;default_envs = teensy40
;env_default = LaunchPad_tm4c1294ncpdt
;env_default = genericSTM32F103RB
;env_default = bluepill_f103c8

[env:native]
platform = native
Expand Down
25 changes: 6 additions & 19 deletions speeduino/board_stm32_official.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@ HardwareTimer Timer1(TIM1);
HardwareTimer Timer2(TIM2);
HardwareTimer Timer3(TIM3);
HardwareTimer Timer4(TIM4);
#if !defined(ARDUINO_BLUEPILL_F103C8) && !defined(ARDUINO_BLUEPILL_F103CB) //F103 just have 4 timers
HardwareTimer Timer5(TIM5);
#if defined(TIM11)
HardwareTimer Timer11(TIM11);
#elif defined(TIM7)
HardwareTimer Timer11(TIM7);
#endif
#endif

#ifdef RTC_ENABLED
STM32RTC& rtc = STM32RTC::getInstance();
Expand Down Expand Up @@ -130,25 +128,14 @@ STM32RTC& rtc = STM32RTC::getInstance();
***********************************************************************************************************
* Timers
*/
#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB)
Timer4.setOverflow(1000, MICROSEC_FORMAT); // Set up period
#if ( STM32_CORE_VERSION_MAJOR < 2 )
Timer4.setMode(1, TIMER_OUTPUT_COMPARE);
Timer4.attachInterrupt(1, oneMSInterval);
#else //2.0 forward
Timer4.attachInterrupt(oneMSInterval);
#endif
Timer4.resume(); //Start Timer
Timer11.setOverflow(1000, MICROSEC_FORMAT); // Set up period
#if ( STM32_CORE_VERSION_MAJOR < 2 )
Timer11.setMode(1, TIMER_OUTPUT_COMPARE);
Timer11.attachInterrupt(1, oneMSInterval);
#else
Timer11.setOverflow(1000, MICROSEC_FORMAT); // Set up period
#if ( STM32_CORE_VERSION_MAJOR < 2 )
Timer11.setMode(1, TIMER_OUTPUT_COMPARE);
Timer11.attachInterrupt(1, oneMSInterval);
#else
Timer11.attachInterrupt(oneMSInterval);
#endif
Timer11.resume(); //Start Timer
Timer11.attachInterrupt(oneMSInterval);
#endif
Timer11.resume(); //Start Timer
pinMode(LED_BUILTIN, OUTPUT); //Visual WDT

/*
Expand Down
24 changes: 3 additions & 21 deletions speeduino/board_stm32_official.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#endif
#endif

#if defined(STM32F1)
#include "stm32f1xx_ll_tim.h"
#elif defined(STM32F3)
#if defined(STM32F3)
#include "stm32f3xx_ll_tim.h"
#elif defined(STM32F4)
#include "stm32f4xx_ll_tim.h"
Expand Down Expand Up @@ -50,8 +48,7 @@
#define word(h, l) ((h << 8) | l) //word() function not defined for this platform in the main library
#endif

#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB) \
|| defined(ARDUINO_BLACKPILL_F401CC) || defined(ARDUINO_BLACKPILL_F411CE)
#if defined(ARDUINO_BLACKPILL_F401CC) || defined(ARDUINO_BLACKPILL_F411CE)
//STM32 Pill boards
#ifndef NUM_DIGITAL_PINS
#define NUM_DIGITAL_PINS 35
Expand All @@ -65,11 +62,6 @@
#endif
#endif

//Specific mode for Bluepill due to its small flash size. This disables a number of strings from being compiled into the flash
#if defined(MCU_STM32F103C8) || defined(MCU_STM32F103CB)
#define SMALL_FLASH_MODE
#endif

#define BOARD_MAX_DIGITAL_PINS NUM_DIGITAL_PINS
#define BOARD_MAX_IO_PINS NUM_DIGITAL_PINS
#if __GNUC__ < 7 //Already included on GCC 7
Expand Down Expand Up @@ -110,8 +102,7 @@ uint16_t freeRam();
void doSystemReset();
void jumpToBootloader();

#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB) \
|| defined(ARDUINO_BLACKPILL_F401CC) || defined(ARDUINO_BLACKPILL_F411CE)
#if defined(ARDUINO_BLACKPILL_F401CC) || defined(ARDUINO_BLACKPILL_F411CE)
#define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PC14) || ((pin) == PC15) )

#ifndef PB11 //Hack for F4 BlackPills
Expand Down Expand Up @@ -187,13 +178,6 @@ void jumpToBootloader();
/*
***********************************************************************************************************
* Schedules
* Timers Table for STM32F1
* TIMER1 TIMER2 TIMER3 TIMER4
* 1 - FAN 1 - INJ1 1 - IGN1 1 - oneMSInterval
* 2 - BOOST 2 - INJ2 2 - IGN2 2 -
* 3 - VVT 3 - INJ3 3 - IGN3 3 -
* 4 - IDLE 4 - INJ4 4 - IGN4 4 -
*
* Timers Table for STM32F4
* TIMER1 | TIMER2 | TIMER3 | TIMER4 | TIMER5 | TIMER11
* 1 - FAN |1 - INJ1 |1 - IGN1 |1 - IGN5 |1 - INJ5 |1 - oneMSInterval
Expand Down Expand Up @@ -328,14 +312,12 @@ extern HardwareTimer Timer1;
extern HardwareTimer Timer2;
extern HardwareTimer Timer3;
extern HardwareTimer Timer4;
#if !defined(ARDUINO_BLUEPILL_F103C8) && !defined(ARDUINO_BLUEPILL_F103CB) //F103 just have 4 timers
extern HardwareTimer Timer5;
#if defined(TIM11)
extern HardwareTimer Timer11;
#elif defined(TIM7)
extern HardwareTimer Timer11;
#endif
#endif

#if ((STM32_CORE_VERSION_MINOR<=8) & (STM32_CORE_VERSION_MAJOR==1))
void oneMSInterval(HardwareTimer*);
Expand Down
39 changes: 0 additions & 39 deletions speeduino/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2553,45 +2553,6 @@ void setPinMapping(byte boardID)
pinFlex = PC14; // Flex sensor (Must be external interrupt enabled)
pinTrigger = PC13; //The CAS pin also led pin so bad idea
pinTrigger2 = PC15; //The Cam Sensor pin

#elif defined(CORE_STM32)
//blue pill wiki.stm32duino.com/index.php?title=Blue_Pill
//Maple mini wiki.stm32duino.com/index.php?title=Maple_Mini
//pins PA12, PA11 are used for USB or CAN couldn't be used for GPIO
//PB2 can't be used as input because is BOOT pin
pinInjector1 = PB7; //Output pin injector 1 is on
pinInjector2 = PB6; //Output pin injector 2 is on
pinInjector3 = PB5; //Output pin injector 3 is on
pinInjector4 = PB4; //Output pin injector 4 is on
pinCoil1 = PB3; //Pin for coil 1
pinCoil2 = PA15; //Pin for coil 2
pinCoil3 = PA14; //Pin for coil 3
pinCoil4 = PA9; //Pin for coil 4
pinCoil5 = PA8; //Pin for coil 5
pinTPS = A0; //TPS input pin
pinMAP = A1; //MAP sensor pin
pinIAT = A2; //IAT sensor pin
pinCLT = A3; //CLS sensor pin
pinO2 = A4; //O2 Sensor pin
pinBat = A5; //Battery reference voltage pin
pinBaro = pinMAP;
pinIdle1 = PB2; //Single wire idle control
pinIdle2 = PA2; //2 wire idle control
pinBoost = PA1; //Boost control
pinVVT_1 = PA0; //Default VVT output
pinVVT_2 = PA2; //Default VVT2 output
pinStepperDir = PC15; //Direction pin for DRV8825 driver
pinStepperStep = PC14; //Step pin for DRV8825 driver
pinStepperEnable = PC13; //Enable pin for DRV8825
pinDisplayReset = PB2; // OLED reset pin
pinFan = PB1; //Pin for the fan output
pinFuelPump = PB11; //Fuel pump output
pinTachOut = PB10; //Tacho output pin
//external interrupt enabled pins
pinFlex = PB8; // Flex sensor (Must be external interrupt enabled)
pinTrigger = PA10; //The CAS pin
pinTrigger2 = PA13; //The Cam Sensor pin

#endif
break;
default:
Expand Down

0 comments on commit 90334a4

Please sign in to comment.