4#if defined(STM32_CORE_VERSION_MAJOR)
5#include <HardwareTimer.h>
6#include <HardwareSerial.h>
12 #error "USBCON must be defined in boards.txt"
15 #error "USBD_USE_CDC must be defined in boards.txt"
20 #include "stm32f1xx_ll_tim.h"
22 #include "stm32f3xx_ll_tim.h"
24 #include "stm32f4xx_ll_tim.h"
25 #if defined(STM32F407xx) && !defined(HAL_CAN_MODULE_ENABLED)
26 #warning "CAN module is not enabled. Internal CAN will NOT be available"
29 #include "stm32f4xx_ll_tim.h"
35#define PORT_TYPE uint32_t
36#define PINMASK_TYPE uint32_t
37#define COMPARE_TYPE uint16_t
38#define COUNTER_TYPE uint16_t
39#define SERIAL_BUFFER_SIZE 517
40#define FPU_MAX_SIZE 32
41#define micros_safe() micros()
42#define TIMER_RESOLUTION 4
50 #define word(h, l) ((h << 8) | l)
53#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB) \
54 || defined(ARDUINO_BLACKPILL_F401CC) || defined(ARDUINO_BLACKPILL_F411CE)
56 #ifndef NUM_DIGITAL_PINS
57 #define NUM_DIGITAL_PINS 35
60 #define LED_BUILTIN PB1
62#elif defined(STM32F407xx)
63 #ifndef NUM_DIGITAL_PINS
64 #define NUM_DIGITAL_PINS 75
69#if defined(MCU_STM32F103C8) || defined(MCU_STM32F103CB)
70 #define SMALL_FLASH_MODE
73#define BOARD_MAX_DIGITAL_PINS NUM_DIGITAL_PINS
74#define BOARD_MAX_IO_PINS NUM_DIGITAL_PINS
78#ifndef digitalPinToInterrupt
83 #define EEPROM_RESET_PIN USER_BTN
86#if defined(STM32F407xx)
91#if defined(SD_LOGGING)
95 #define SD_CONFIG SdSpiConfig(SD_CS_PIN, DEDICATED_SPI, SD_SCK_MHZ(50), &SD_SPI)
102#if SERIAL_UART_INSTANCE==2
113#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB) \
114 || defined(ARDUINO_BLACKPILL_F401CC) || defined(ARDUINO_BLACKPILL_F411CE)
115 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PC14) || ((pin) == PC15) )
130 #ifdef USE_SPI_EEPROM
131 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PB3) || ((pin) == PB4) || ((pin) == PB5) || ((pin) == USE_SPI_EEPROM) )
133 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PB3) || ((pin) == PB4) || ((pin) == PB5) || ((pin) == PB0) )
137#define PWM_FAN_AVAILABLE
140 #define LED_BUILTIN PA7
147#if defined(SRAM_AS_EEPROM)
148 #define EEPROM_LIB_H "src/BackupSram/BackupSramAsEEPROM.h"
150 #include EEPROM_LIB_H
153#elif defined(USE_SPI_EEPROM)
154 #define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
156 #include EEPROM_LIB_H
164#elif defined(FRAM_AS_EEPROM)
165 #define EEPROM_LIB_H "src/FRAM/Fram.h"
167 #include EEPROM_LIB_H
168 #if defined(STM32F407xx)
175 #define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
177 #include EEPROM_LIB_H
179 #if defined(STM32F401xC)
180 #define SMALL_FLASH_MODE
185#define RTC_LIB_H "STM32RTC.h"
204#define MAX_TIMER_PERIOD 65535*4
205#define uS_TO_TIMER_COMPARE(uS) (uS>>2)
207#define FUEL1_COUNTER (TIM3)->CNT
208#define FUEL2_COUNTER (TIM3)->CNT
209#define FUEL3_COUNTER (TIM3)->CNT
210#define FUEL4_COUNTER (TIM3)->CNT
212#define FUEL1_COMPARE (TIM3)->CCR1
213#define FUEL2_COMPARE (TIM3)->CCR2
214#define FUEL3_COMPARE (TIM3)->CCR3
215#define FUEL4_COMPARE (TIM3)->CCR4
217#define IGN1_COUNTER (TIM2)->CNT
218#define IGN2_COUNTER (TIM2)->CNT
219#define IGN3_COUNTER (TIM2)->CNT
220#define IGN4_COUNTER (TIM2)->CNT
222#define IGN1_COMPARE (TIM2)->CCR1
223#define IGN2_COMPARE (TIM2)->CCR2
224#define IGN3_COMPARE (TIM2)->CCR3
225#define IGN4_COMPARE (TIM2)->CCR4
227#define FUEL5_COUNTER (TIM5)->CNT
228#define FUEL6_COUNTER (TIM5)->CNT
229#define FUEL7_COUNTER (TIM5)->CNT
230#define FUEL8_COUNTER (TIM5)->CNT
232#define FUEL5_COMPARE (TIM5)->CCR1
233#define FUEL6_COMPARE (TIM5)->CCR2
234#define FUEL7_COMPARE (TIM5)->CCR3
235#define FUEL8_COMPARE (TIM5)->CCR4
237#define IGN5_COUNTER (TIM4)->CNT
238#define IGN6_COUNTER (TIM4)->CNT
239#define IGN7_COUNTER (TIM4)->CNT
240#define IGN8_COUNTER (TIM4)->CNT
242#define IGN5_COMPARE (TIM4)->CCR1
243#define IGN6_COMPARE (TIM4)->CCR2
244#define IGN7_COMPARE (TIM4)->CCR3
245#define IGN8_COMPARE (TIM4)->CCR4
296#define ENABLE_BOOST_TIMER() (TIM1)->SR = ~TIM_FLAG_CC2; (TIM1)->DIER |= TIM_DIER_CC2IE; (TIM1)->CR1 |= TIM_CR1_CEN;
297#define DISABLE_BOOST_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC2IE
299#define ENABLE_VVT_TIMER() (TIM1)->SR = ~TIM_FLAG_CC3; (TIM1)->DIER |= TIM_DIER_CC3IE; (TIM1)->CR1 |= TIM_CR1_CEN;
300#define DISABLE_VVT_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC3IE
302#define ENABLE_FAN_TIMER() (TIM1)->SR = ~TIM_FLAG_CC1; (TIM1)->DIER |= TIM_DIER_CC1IE; (TIM1)->CR1 |= TIM_CR1_CEN;
303#define DISABLE_FAN_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC1IE
305#define BOOST_TIMER_COMPARE (TIM1)->CCR2
306#define BOOST_TIMER_COUNTER (TIM1)->CNT
307#define VVT_TIMER_COMPARE (TIM1)->CCR3
308#define VVT_TIMER_COUNTER (TIM1)->CNT
309#define FAN_TIMER_COMPARE (TIM1)->CCR1
310#define FAN_TIMER_COUNTER (TIM1)->CNT
316#define IDLE_COUNTER (TIM1)->CNT
317#define IDLE_COMPARE (TIM1)->CCR4
319#define IDLE_TIMER_ENABLE() (TIM1)->SR = ~TIM_FLAG_CC4; (TIM1)->DIER |= TIM_DIER_CC4IE; (TIM1)->CR1 |= TIM_CR1_CEN;
320#define IDLE_TIMER_DISABLE() (TIM1)->DIER &= ~TIM_DIER_CC4IE
331#if !defined(ARDUINO_BLUEPILL_F103C8) && !defined(ARDUINO_BLUEPILL_F103CB)
340#if ((STM32_CORE_VERSION_MINOR<=8) & (STM32_CORE_VERSION_MAJOR==1))
347#if (INJ_CHANNELS >= 5)
350#if (INJ_CHANNELS >= 6)
353#if (INJ_CHANNELS >= 7)
356#if (INJ_CHANNELS >= 8)
366#if (IGN_CHANNELS >= 5)
369#if (IGN_CHANNELS >= 6)
372#if (IGN_CHANNELS >= 7)
375#if (IGN_CHANNELS >= 8)
384#if defined(HAL_CAN_MODULE_ENABLED)
385#define NATIVE_CAN_AVAILABLE
386#include <src/STM32_CAN/STM32_CAN.h>
391#define secondarySerial_AVAILABLE
392#if defined(STM32GENERIC)
393 #define SECONDARY_SERIAL_T SerialUART
395 #define SECONDARY_SERIAL_T HardwareSerial
void vvtInterrupt(void)
Definition auxiliaries.cpp:1146
void boostInterrupt(void)
Definition auxiliaries.cpp:1116
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
void idleInterrupt(void)
Definition idle.cpp:845
void fuelSchedule1Interrupt()
Definition scheduler.cpp:364
void fuelSchedule3Interrupt()
Definition scheduler.cpp:384
void fuelSchedule2Interrupt()
Definition scheduler.cpp:374
void fuelSchedule4Interrupt()
Definition scheduler.cpp:394
void ignitionSchedule1Interrupt(void)
Definition scheduler.cpp:487
void oneMSInterval(void)
Definition timers.cpp:76