diff --git a/board__stm32__official_8h_source.html b/board__stm32__official_8h_source.html index 46f2aab86..4078bb42f 100644 --- a/board__stm32__official_8h_source.html +++ b/board__stm32__official_8h_source.html @@ -211,276 +211,280 @@
127 #define A15 PA5
128 #endif
129#else
-
130 #ifdef USE_SPI_EEPROM
-
131 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PB3) || ((pin) == PB4) || ((pin) == PB5) || ((pin) == USE_SPI_EEPROM) ) //Forbidden pins like USB
-
132 #else
-
133 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PB3) || ((pin) == PB4) || ((pin) == PB5) || ((pin) == PB0) ) //Forbidden pins like USB
-
134 #endif
-
135#endif
-
136
-
137#define PWM_FAN_AVAILABLE
-
138
-
139#ifndef LED_BUILTIN
-
140 #define LED_BUILTIN PA7
-
141#endif
+
130 /* PA11/PA12 is USB
+
131 * PD0/PD1 is CAN
+
132 * PB0/PB3/PB4/PB5 is SPI used for external flash on black F407
+
133 */
+
134 #ifdef USE_SPI_EEPROM
+
135 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PD0) || ((pin) == PD1) || ((pin) == PB3) || ((pin) == PB4) || ((pin) == PB5) || ((pin) == USE_SPI_EEPROM) ) //Forbidden pins like USB
+
136 #else
+
137 #define pinIsReserved(pin) ( ((pin) == PA11) || ((pin) == PA12) || ((pin) == PD0) || ((pin) == PD1) || ((pin) == PB3) || ((pin) == PB4) || ((pin) == PB5) || ((pin) == PB0) ) //Forbidden pins like USB
+
138 #endif
+
139#endif
+
140
+
141#define PWM_FAN_AVAILABLE
142
-
143/*
-
144***********************************************************************************************************
-
145* EEPROM emulation
-
146*/
-
147#if defined(SRAM_AS_EEPROM)
-
148 #define EEPROM_LIB_H "src/BackupSram/BackupSramAsEEPROM.h"
-
149 typedef uint16_t eeprom_address_t;
-
150 #include EEPROM_LIB_H
-
151 extern BackupSramAsEEPROM EEPROM;
-
152
-
153#elif defined(USE_SPI_EEPROM)
-
154 #define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
-
155 typedef uint16_t eeprom_address_t;
-
156 #include EEPROM_LIB_H
-
157 extern SPIClass SPI_for_flash; //SPI1_MOSI, SPI1_MISO, SPI1_SCK
-
158
-
159 //windbond W25Q16 SPI flash EEPROM emulation
-
160 extern EEPROM_Emulation_Config EmulatedEEPROMMconfig;
-
161 extern Flash_SPI_Config SPIconfig;
-
162 extern SPI_EEPROM_Class EEPROM;
-
163
-
164#elif defined(FRAM_AS_EEPROM) //https://github.com/VitorBoss/FRAM
-
165 #define EEPROM_LIB_H "src/FRAM/Fram.h"
-
166 typedef uint16_t eeprom_address_t;
-
167 #include EEPROM_LIB_H
-
168 #if defined(STM32F407xx)
-
169 extern FramClass EEPROM; /*(mosi, miso, sclk, ssel, clockspeed) 31/01/2020*/
-
170 #else
-
171 extern FramClass EEPROM; //Blue/Black Pills
-
172 #endif
-
173
-
174#else //default case, internal flash as EEPROM
-
175 #define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
-
176 typedef uint16_t eeprom_address_t;
-
177 #include EEPROM_LIB_H
-
178 extern InternalSTM32F4_EEPROM_Class EEPROM;
-
179 #if defined(STM32F401xC)
-
180 #define SMALL_FLASH_MODE
-
181 #endif
-
182#endif
-
183
-
184
-
185#define RTC_LIB_H "STM32RTC.h"
-
186
-
187/*
-
188***********************************************************************************************************
-
189* Schedules
-
190* Timers Table for STM32F1
-
191* TIMER1 TIMER2 TIMER3 TIMER4
-
192* 1 - FAN 1 - INJ1 1 - IGN1 1 - oneMSInterval
-
193* 2 - BOOST 2 - INJ2 2 - IGN2 2 -
-
194* 3 - VVT 3 - INJ3 3 - IGN3 3 -
-
195* 4 - IDLE 4 - INJ4 4 - IGN4 4 -
-
196*
-
197* Timers Table for STM32F4
-
198* TIMER1 | TIMER2 | TIMER3 | TIMER4 | TIMER5 | TIMER11
-
199* 1 - FAN |1 - INJ1 |1 - IGN1 |1 - IGN5 |1 - INJ5 |1 - oneMSInterval
-
200* 2 - BOOST |2 - INJ2 |2 - IGN2 |2 - IGN6 |2 - INJ6 |
-
201* 3 - VVT |3 - INJ3 |3 - IGN3 |3 - IGN7 |3 - INJ7 |
-
202* 4 - IDLE |4 - INJ4 |4 - IGN4 |4 - IGN8 |4 - INJ8 |
-
203*/
-
204#define MAX_TIMER_PERIOD 65535*4 //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 4, as each timer tick is 4uS)
-
205#define uS_TO_TIMER_COMPARE(uS) (uS>>2) //Converts a given number of uS into the required number of timer ticks until that time has passed.
-
206
-
207#define FUEL1_COUNTER (TIM3)->CNT
-
208#define FUEL2_COUNTER (TIM3)->CNT
-
209#define FUEL3_COUNTER (TIM3)->CNT
-
210#define FUEL4_COUNTER (TIM3)->CNT
-
211
-
212#define FUEL1_COMPARE (TIM3)->CCR1
-
213#define FUEL2_COMPARE (TIM3)->CCR2
-
214#define FUEL3_COMPARE (TIM3)->CCR3
-
215#define FUEL4_COMPARE (TIM3)->CCR4
-
216
-
217#define IGN1_COUNTER (TIM2)->CNT
-
218#define IGN2_COUNTER (TIM2)->CNT
-
219#define IGN3_COUNTER (TIM2)->CNT
-
220#define IGN4_COUNTER (TIM2)->CNT
-
221
-
222#define IGN1_COMPARE (TIM2)->CCR1
-
223#define IGN2_COMPARE (TIM2)->CCR2
-
224#define IGN3_COMPARE (TIM2)->CCR3
-
225#define IGN4_COMPARE (TIM2)->CCR4
-
226
-
227#define FUEL5_COUNTER (TIM5)->CNT
-
228#define FUEL6_COUNTER (TIM5)->CNT
-
229#define FUEL7_COUNTER (TIM5)->CNT
-
230#define FUEL8_COUNTER (TIM5)->CNT
-
231
-
232#define FUEL5_COMPARE (TIM5)->CCR1
-
233#define FUEL6_COMPARE (TIM5)->CCR2
-
234#define FUEL7_COMPARE (TIM5)->CCR3
-
235#define FUEL8_COMPARE (TIM5)->CCR4
-
236
-
237#define IGN5_COUNTER (TIM4)->CNT
-
238#define IGN6_COUNTER (TIM4)->CNT
-
239#define IGN7_COUNTER (TIM4)->CNT
-
240#define IGN8_COUNTER (TIM4)->CNT
-
241
-
242#define IGN5_COMPARE (TIM4)->CCR1
-
243#define IGN6_COMPARE (TIM4)->CCR2
-
244#define IGN7_COMPARE (TIM4)->CCR3
-
245#define IGN8_COMPARE (TIM4)->CCR4
-
246
-
247
-
248static inline void FUEL1_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC1; (TIM3)->DIER |= TIM_DIER_CC1IE;}
-
249static inline void FUEL2_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC2; (TIM3)->DIER |= TIM_DIER_CC2IE;}
-
250static inline void FUEL3_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC3; (TIM3)->DIER |= TIM_DIER_CC3IE;}
-
251static inline void FUEL4_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC4; (TIM3)->DIER |= TIM_DIER_CC4IE;}
-
252
-
253static inline void FUEL1_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC1IE;}
-
254static inline void FUEL2_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC2IE;}
-
255static inline void FUEL3_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC3IE;}
-
256static inline void FUEL4_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC4IE;}
-
257
-
258 static inline void IGN1_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC1; (TIM2)->DIER |= TIM_DIER_CC1IE;}
-
259 static inline void IGN2_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC2; (TIM2)->DIER |= TIM_DIER_CC2IE;}
-
260 static inline void IGN3_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC3; (TIM2)->DIER |= TIM_DIER_CC3IE;}
-
261 static inline void IGN4_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC4; (TIM2)->DIER |= TIM_DIER_CC4IE;}
-
262
-
263 static inline void IGN1_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC1IE;}
-
264 static inline void IGN2_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC2IE;}
-
265 static inline void IGN3_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC3IE;}
-
266 static inline void IGN4_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC4IE;}
-
267
-
268
-
269static inline void FUEL5_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC1; (TIM5)->DIER |= TIM_DIER_CC1IE;}
-
270static inline void FUEL6_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC2; (TIM5)->DIER |= TIM_DIER_CC2IE;}
-
271static inline void FUEL7_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC3; (TIM5)->DIER |= TIM_DIER_CC3IE;}
-
272static inline void FUEL8_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC4; (TIM5)->DIER |= TIM_DIER_CC4IE;}
-
273
-
274static inline void FUEL5_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC1IE;}
-
275static inline void FUEL6_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC2IE;}
-
276static inline void FUEL7_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC3IE;}
-
277static inline void FUEL8_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC4IE;}
-
278
-
279 static inline void IGN5_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC1; (TIM4)->DIER |= TIM_DIER_CC1IE;}
-
280 static inline void IGN6_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC2; (TIM4)->DIER |= TIM_DIER_CC2IE;}
-
281 static inline void IGN7_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC3; (TIM4)->DIER |= TIM_DIER_CC3IE;}
-
282 static inline void IGN8_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC4; (TIM4)->DIER |= TIM_DIER_CC4IE;}
-
283
-
284 static inline void IGN5_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC1IE;}
-
285 static inline void IGN6_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC2IE;}
-
286 static inline void IGN7_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC3IE;}
-
287 static inline void IGN8_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC4IE;}
-
288
-
289
-
290
-
291
-
292/*
-
293***********************************************************************************************************
-
294* Auxiliaries
-
295*/
-
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
-
298
-
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
-
301
-
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
-
304
-
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
-
311
-
312/*
-
313***********************************************************************************************************
-
314* Idle
-
315*/
-
316#define IDLE_COUNTER (TIM1)->CNT
-
317#define IDLE_COMPARE (TIM1)->CCR4
-
318
-
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
-
321
-
322/*
-
323***********************************************************************************************************
-
324* Timers
-
325*/
-
326
-
327extern HardwareTimer Timer1;
-
328extern HardwareTimer Timer2;
-
329extern HardwareTimer Timer3;
-
330extern HardwareTimer Timer4;
-
331#if !defined(ARDUINO_BLUEPILL_F103C8) && !defined(ARDUINO_BLUEPILL_F103CB) //F103 just have 4 timers
-
332extern HardwareTimer Timer5;
-
333#if defined(TIM11)
-
334extern HardwareTimer Timer11;
-
335#elif defined(TIM7)
-
336extern HardwareTimer Timer11;
-
337#endif
-
338#endif
-
339
-
340#if ((STM32_CORE_VERSION_MINOR<=8) & (STM32_CORE_VERSION_MAJOR==1))
-
341void oneMSInterval(HardwareTimer*);
-
342void boostInterrupt(HardwareTimer*);
-
343void fuelSchedule1Interrupt(HardwareTimer*);
-
344void fuelSchedule2Interrupt(HardwareTimer*);
-
345void fuelSchedule3Interrupt(HardwareTimer*);
-
346void fuelSchedule4Interrupt(HardwareTimer*);
-
347#if (INJ_CHANNELS >= 5)
-
348void fuelSchedule5Interrupt(HardwareTimer*);
-
349#endif
-
350#if (INJ_CHANNELS >= 6)
-
351void fuelSchedule6Interrupt(HardwareTimer*);
-
352#endif
-
353#if (INJ_CHANNELS >= 7)
-
354void fuelSchedule7Interrupt(HardwareTimer*);
-
355#endif
-
356#if (INJ_CHANNELS >= 8)
-
357void fuelSchedule8Interrupt(HardwareTimer*);
-
358#endif
-
359void idleInterrupt(HardwareTimer*);
-
360void vvtInterrupt(HardwareTimer*);
-
361void fanInterrupt(HardwareTimer*);
-
362void ignitionSchedule1Interrupt(HardwareTimer*);
-
363void ignitionSchedule2Interrupt(HardwareTimer*);
-
364void ignitionSchedule3Interrupt(HardwareTimer*);
-
365void ignitionSchedule4Interrupt(HardwareTimer*);
-
366#if (IGN_CHANNELS >= 5)
-
367void ignitionSchedule5Interrupt(HardwareTimer*);
-
368#endif
-
369#if (IGN_CHANNELS >= 6)
-
370void ignitionSchedule6Interrupt(HardwareTimer*);
-
371#endif
-
372#if (IGN_CHANNELS >= 7)
-
373void ignitionSchedule7Interrupt(HardwareTimer*);
-
374#endif
-
375#if (IGN_CHANNELS >= 8)
-
376void ignitionSchedule8Interrupt(HardwareTimer*);
-
377#endif
-
378#endif //End core<=1.8
-
379
-
380/*
-
381***********************************************************************************************************
-
382* CAN / Second serial
-
383*/
-
384#if defined(HAL_CAN_MODULE_ENABLED)
-
385#define NATIVE_CAN_AVAILABLE
-
386#include <src/STM32_CAN/STM32_CAN.h>
-
387//This activates CAN1 interface on STM32, but it's named as Can0, because that's how Teensy implementation is done
-
388extern STM32_CAN Can0;
-
389#endif
-
390
-
391#define secondarySerial_AVAILABLE
-
392#if defined(STM32GENERIC) // STM32GENERIC core
-
393 #define SECONDARY_SERIAL_T SerialUART
-
394#else //libmaple core aka STM32DUINO
-
395 #define SECONDARY_SERIAL_T HardwareSerial
-
396#endif
-
397
-
398#endif //CORE_STM32
-
399#endif //STM32_H
+
143#ifndef LED_BUILTIN
+
144 #define LED_BUILTIN PA7
+
145#endif
+
146
+
147/*
+
148***********************************************************************************************************
+
149* EEPROM emulation
+
150*/
+
151#if defined(SRAM_AS_EEPROM)
+
152 #define EEPROM_LIB_H "src/BackupSram/BackupSramAsEEPROM.h"
+
153 typedef uint16_t eeprom_address_t;
+
154 #include EEPROM_LIB_H
+
155 extern BackupSramAsEEPROM EEPROM;
+
156
+
157#elif defined(USE_SPI_EEPROM)
+
158 #define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
+
159 typedef uint16_t eeprom_address_t;
+
160 #include EEPROM_LIB_H
+
161 extern SPIClass SPI_for_flash; //SPI1_MOSI, SPI1_MISO, SPI1_SCK
+
162
+
163 //windbond W25Q16 SPI flash EEPROM emulation
+
164 extern EEPROM_Emulation_Config EmulatedEEPROMMconfig;
+
165 extern Flash_SPI_Config SPIconfig;
+
166 extern SPI_EEPROM_Class EEPROM;
+
167
+
168#elif defined(FRAM_AS_EEPROM) //https://github.com/VitorBoss/FRAM
+
169 #define EEPROM_LIB_H "src/FRAM/Fram.h"
+
170 typedef uint16_t eeprom_address_t;
+
171 #include EEPROM_LIB_H
+
172 #if defined(STM32F407xx)
+
173 extern FramClass EEPROM; /*(mosi, miso, sclk, ssel, clockspeed) 31/01/2020*/
+
174 #else
+
175 extern FramClass EEPROM; //Blue/Black Pills
+
176 #endif
+
177
+
178#else //default case, internal flash as EEPROM
+
179 #define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
+
180 typedef uint16_t eeprom_address_t;
+
181 #include EEPROM_LIB_H
+
182 extern InternalSTM32F4_EEPROM_Class EEPROM;
+
183 #if defined(STM32F401xC)
+
184 #define SMALL_FLASH_MODE
+
185 #endif
+
186#endif
+
187
+
188
+
189#define RTC_LIB_H "STM32RTC.h"
+
190
+
191/*
+
192***********************************************************************************************************
+
193* Schedules
+
194* Timers Table for STM32F1
+
195* TIMER1 TIMER2 TIMER3 TIMER4
+
196* 1 - FAN 1 - INJ1 1 - IGN1 1 - oneMSInterval
+
197* 2 - BOOST 2 - INJ2 2 - IGN2 2 -
+
198* 3 - VVT 3 - INJ3 3 - IGN3 3 -
+
199* 4 - IDLE 4 - INJ4 4 - IGN4 4 -
+
200*
+
201* Timers Table for STM32F4
+
202* TIMER1 | TIMER2 | TIMER3 | TIMER4 | TIMER5 | TIMER11
+
203* 1 - FAN |1 - INJ1 |1 - IGN1 |1 - IGN5 |1 - INJ5 |1 - oneMSInterval
+
204* 2 - BOOST |2 - INJ2 |2 - IGN2 |2 - IGN6 |2 - INJ6 |
+
205* 3 - VVT |3 - INJ3 |3 - IGN3 |3 - IGN7 |3 - INJ7 |
+
206* 4 - IDLE |4 - INJ4 |4 - IGN4 |4 - IGN8 |4 - INJ8 |
+
207*/
+
208#define MAX_TIMER_PERIOD 65535*4 //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 4, as each timer tick is 4uS)
+
209#define uS_TO_TIMER_COMPARE(uS) (uS>>2) //Converts a given number of uS into the required number of timer ticks until that time has passed.
+
210
+
211#define FUEL1_COUNTER (TIM3)->CNT
+
212#define FUEL2_COUNTER (TIM3)->CNT
+
213#define FUEL3_COUNTER (TIM3)->CNT
+
214#define FUEL4_COUNTER (TIM3)->CNT
+
215
+
216#define FUEL1_COMPARE (TIM3)->CCR1
+
217#define FUEL2_COMPARE (TIM3)->CCR2
+
218#define FUEL3_COMPARE (TIM3)->CCR3
+
219#define FUEL4_COMPARE (TIM3)->CCR4
+
220
+
221#define IGN1_COUNTER (TIM2)->CNT
+
222#define IGN2_COUNTER (TIM2)->CNT
+
223#define IGN3_COUNTER (TIM2)->CNT
+
224#define IGN4_COUNTER (TIM2)->CNT
+
225
+
226#define IGN1_COMPARE (TIM2)->CCR1
+
227#define IGN2_COMPARE (TIM2)->CCR2
+
228#define IGN3_COMPARE (TIM2)->CCR3
+
229#define IGN4_COMPARE (TIM2)->CCR4
+
230
+
231#define FUEL5_COUNTER (TIM5)->CNT
+
232#define FUEL6_COUNTER (TIM5)->CNT
+
233#define FUEL7_COUNTER (TIM5)->CNT
+
234#define FUEL8_COUNTER (TIM5)->CNT
+
235
+
236#define FUEL5_COMPARE (TIM5)->CCR1
+
237#define FUEL6_COMPARE (TIM5)->CCR2
+
238#define FUEL7_COMPARE (TIM5)->CCR3
+
239#define FUEL8_COMPARE (TIM5)->CCR4
+
240
+
241#define IGN5_COUNTER (TIM4)->CNT
+
242#define IGN6_COUNTER (TIM4)->CNT
+
243#define IGN7_COUNTER (TIM4)->CNT
+
244#define IGN8_COUNTER (TIM4)->CNT
+
245
+
246#define IGN5_COMPARE (TIM4)->CCR1
+
247#define IGN6_COMPARE (TIM4)->CCR2
+
248#define IGN7_COMPARE (TIM4)->CCR3
+
249#define IGN8_COMPARE (TIM4)->CCR4
+
250
+
251
+
252static inline void FUEL1_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC1; (TIM3)->DIER |= TIM_DIER_CC1IE;}
+
253static inline void FUEL2_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC2; (TIM3)->DIER |= TIM_DIER_CC2IE;}
+
254static inline void FUEL3_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC3; (TIM3)->DIER |= TIM_DIER_CC3IE;}
+
255static inline void FUEL4_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC4; (TIM3)->DIER |= TIM_DIER_CC4IE;}
+
256
+
257static inline void FUEL1_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC1IE;}
+
258static inline void FUEL2_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC2IE;}
+
259static inline void FUEL3_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC3IE;}
+
260static inline void FUEL4_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC4IE;}
+
261
+
262 static inline void IGN1_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC1; (TIM2)->DIER |= TIM_DIER_CC1IE;}
+
263 static inline void IGN2_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC2; (TIM2)->DIER |= TIM_DIER_CC2IE;}
+
264 static inline void IGN3_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC3; (TIM2)->DIER |= TIM_DIER_CC3IE;}
+
265 static inline void IGN4_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC4; (TIM2)->DIER |= TIM_DIER_CC4IE;}
+
266
+
267 static inline void IGN1_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC1IE;}
+
268 static inline void IGN2_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC2IE;}
+
269 static inline void IGN3_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC3IE;}
+
270 static inline void IGN4_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC4IE;}
+
271
+
272
+
273static inline void FUEL5_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC1; (TIM5)->DIER |= TIM_DIER_CC1IE;}
+
274static inline void FUEL6_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC2; (TIM5)->DIER |= TIM_DIER_CC2IE;}
+
275static inline void FUEL7_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC3; (TIM5)->DIER |= TIM_DIER_CC3IE;}
+
276static inline void FUEL8_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC4; (TIM5)->DIER |= TIM_DIER_CC4IE;}
+
277
+
278static inline void FUEL5_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC1IE;}
+
279static inline void FUEL6_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC2IE;}
+
280static inline void FUEL7_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC3IE;}
+
281static inline void FUEL8_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC4IE;}
+
282
+
283 static inline void IGN5_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC1; (TIM4)->DIER |= TIM_DIER_CC1IE;}
+
284 static inline void IGN6_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC2; (TIM4)->DIER |= TIM_DIER_CC2IE;}
+
285 static inline void IGN7_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC3; (TIM4)->DIER |= TIM_DIER_CC3IE;}
+
286 static inline void IGN8_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC4; (TIM4)->DIER |= TIM_DIER_CC4IE;}
+
287
+
288 static inline void IGN5_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC1IE;}
+
289 static inline void IGN6_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC2IE;}
+
290 static inline void IGN7_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC3IE;}
+
291 static inline void IGN8_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC4IE;}
+
292
+
293
+
294
+
295
+
296/*
+
297***********************************************************************************************************
+
298* Auxiliaries
+
299*/
+
300#define ENABLE_BOOST_TIMER() (TIM1)->SR = ~TIM_FLAG_CC2; (TIM1)->DIER |= TIM_DIER_CC2IE; (TIM1)->CR1 |= TIM_CR1_CEN;
+
301#define DISABLE_BOOST_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC2IE
+
302
+
303#define ENABLE_VVT_TIMER() (TIM1)->SR = ~TIM_FLAG_CC3; (TIM1)->DIER |= TIM_DIER_CC3IE; (TIM1)->CR1 |= TIM_CR1_CEN;
+
304#define DISABLE_VVT_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC3IE
+
305
+
306#define ENABLE_FAN_TIMER() (TIM1)->SR = ~TIM_FLAG_CC1; (TIM1)->DIER |= TIM_DIER_CC1IE; (TIM1)->CR1 |= TIM_CR1_CEN;
+
307#define DISABLE_FAN_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC1IE
+
308
+
309#define BOOST_TIMER_COMPARE (TIM1)->CCR2
+
310#define BOOST_TIMER_COUNTER (TIM1)->CNT
+
311#define VVT_TIMER_COMPARE (TIM1)->CCR3
+
312#define VVT_TIMER_COUNTER (TIM1)->CNT
+
313#define FAN_TIMER_COMPARE (TIM1)->CCR1
+
314#define FAN_TIMER_COUNTER (TIM1)->CNT
+
315
+
316/*
+
317***********************************************************************************************************
+
318* Idle
+
319*/
+
320#define IDLE_COUNTER (TIM1)->CNT
+
321#define IDLE_COMPARE (TIM1)->CCR4
+
322
+
323#define IDLE_TIMER_ENABLE() (TIM1)->SR = ~TIM_FLAG_CC4; (TIM1)->DIER |= TIM_DIER_CC4IE; (TIM1)->CR1 |= TIM_CR1_CEN;
+
324#define IDLE_TIMER_DISABLE() (TIM1)->DIER &= ~TIM_DIER_CC4IE
+
325
+
326/*
+
327***********************************************************************************************************
+
328* Timers
+
329*/
+
330
+
331extern HardwareTimer Timer1;
+
332extern HardwareTimer Timer2;
+
333extern HardwareTimer Timer3;
+
334extern HardwareTimer Timer4;
+
335#if !defined(ARDUINO_BLUEPILL_F103C8) && !defined(ARDUINO_BLUEPILL_F103CB) //F103 just have 4 timers
+
336extern HardwareTimer Timer5;
+
337#if defined(TIM11)
+
338extern HardwareTimer Timer11;
+
339#elif defined(TIM7)
+
340extern HardwareTimer Timer11;
+
341#endif
+
342#endif
+
343
+
344#if ((STM32_CORE_VERSION_MINOR<=8) & (STM32_CORE_VERSION_MAJOR==1))
+
345void oneMSInterval(HardwareTimer*);
+
346void boostInterrupt(HardwareTimer*);
+
347void fuelSchedule1Interrupt(HardwareTimer*);
+
348void fuelSchedule2Interrupt(HardwareTimer*);
+
349void fuelSchedule3Interrupt(HardwareTimer*);
+
350void fuelSchedule4Interrupt(HardwareTimer*);
+
351#if (INJ_CHANNELS >= 5)
+
352void fuelSchedule5Interrupt(HardwareTimer*);
+
353#endif
+
354#if (INJ_CHANNELS >= 6)
+
355void fuelSchedule6Interrupt(HardwareTimer*);
+
356#endif
+
357#if (INJ_CHANNELS >= 7)
+
358void fuelSchedule7Interrupt(HardwareTimer*);
+
359#endif
+
360#if (INJ_CHANNELS >= 8)
+
361void fuelSchedule8Interrupt(HardwareTimer*);
+
362#endif
+
363void idleInterrupt(HardwareTimer*);
+
364void vvtInterrupt(HardwareTimer*);
+
365void fanInterrupt(HardwareTimer*);
+
366void ignitionSchedule1Interrupt(HardwareTimer*);
+
367void ignitionSchedule2Interrupt(HardwareTimer*);
+
368void ignitionSchedule3Interrupt(HardwareTimer*);
+
369void ignitionSchedule4Interrupt(HardwareTimer*);
+
370#if (IGN_CHANNELS >= 5)
+
371void ignitionSchedule5Interrupt(HardwareTimer*);
+
372#endif
+
373#if (IGN_CHANNELS >= 6)
+
374void ignitionSchedule6Interrupt(HardwareTimer*);
+
375#endif
+
376#if (IGN_CHANNELS >= 7)
+
377void ignitionSchedule7Interrupt(HardwareTimer*);
+
378#endif
+
379#if (IGN_CHANNELS >= 8)
+
380void ignitionSchedule8Interrupt(HardwareTimer*);
+
381#endif
+
382#endif //End core<=1.8
+
383
+
384/*
+
385***********************************************************************************************************
+
386* CAN / Second serial
+
387*/
+
388#if defined(HAL_CAN_MODULE_ENABLED)
+
389#define NATIVE_CAN_AVAILABLE
+
390#include <src/STM32_CAN/STM32_CAN.h>
+
391//This activates CAN1 interface on STM32, but it's named as Can0, because that's how Teensy implementation is done
+
392extern STM32_CAN Can0;
+
393#endif
+
394
+
395#define secondarySerial_AVAILABLE
+
396#if defined(STM32GENERIC) // STM32GENERIC core
+
397 #define SECONDARY_SERIAL_T SerialUART
+
398#else //libmaple core aka STM32DUINO
+
399 #define SECONDARY_SERIAL_T HardwareSerial
+
400#endif
+
401
+
402#endif //CORE_STM32
+
403#endif //STM32_H
vvtInterrupt
void vvtInterrupt(void)
Definition auxiliaries.cpp:1146
boostInterrupt
void boostInterrupt(void)
Definition auxiliaries.cpp:1116
rshift
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
diff --git a/globals_8cpp.html b/globals_8cpp.html index df794eebe..452de1282 100644 --- a/globals_8cpp.html +++ b/globals_8cpp.html @@ -633,21 +633,25 @@

- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.map b/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.map index 87f70a607..3264bcbd5 100644 --- a/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.map +++ b/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.map @@ -1,17 +1,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 b/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 index dd2cf8b16..ea1e2b557 100644 --- a/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 +++ b/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 @@ -1 +1 @@ -c462fa07e5955eb1ccf6fdbf5ca232ea \ No newline at end of file +1191399c18d4500a4211696706265c61 \ No newline at end of file diff --git a/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.png b/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.png index ebc0fc2a3..fd939af06 100644 Binary files a/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.png and b/globals_8cpp_a60110b76a861e7bdea2683562f6c6314_icgraph.png differ diff --git a/globals_8h.html b/globals_8h.html index b5ccdeac6..3fa1c12f5 100644 --- a/globals_8h.html +++ b/globals_8h.html @@ -5122,21 +5122,25 @@

- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.map b/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.map index 87f70a607..3264bcbd5 100644 --- a/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.map +++ b/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.map @@ -1,17 +1,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 b/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 index dd2cf8b16..ea1e2b557 100644 --- a/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 +++ b/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.md5 @@ -1 +1 @@ -c462fa07e5955eb1ccf6fdbf5ca232ea \ No newline at end of file +1191399c18d4500a4211696706265c61 \ No newline at end of file diff --git a/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.png b/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.png index ebc0fc2a3..fd939af06 100644 Binary files a/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.png and b/globals_8h_a60110b76a861e7bdea2683562f6c6314_icgraph.png differ diff --git a/globals_func_p.html b/globals_func_p.html index 11126238b..e021b492f 100644 --- a/globals_func_p.html +++ b/globals_func_p.html @@ -76,9 +76,11 @@

- p -