Fix STM32 + SoftwareSerial compile (#17831)

This commit is contained in:
Jason Smith
2020-05-02 15:24:51 -07:00
committed by GitHub
parent 52f3f3b5ab
commit 208af8cb15
6 changed files with 23 additions and 15 deletions

View File

@@ -31,9 +31,6 @@
#define NUM_HARDWARE_TIMERS 2
#ifndef SWSERIAL_TIMER_IRQ_PRIO
#define SWSERIAL_TIMER_IRQ_PRIO 1
#endif
#ifndef STEP_TIMER_IRQ_PRIO
#define STEP_TIMER_IRQ_PRIO 2
#endif
@@ -41,6 +38,13 @@
#define TEMP_TIMER_IRQ_PRIO 14 // 14 = after hardware ISRs
#endif
#if HAS_TMC_SW_SERIAL
#include <SoftwareSerial.h>
#ifndef SWSERIAL_TIMER_IRQ_PRIO
#define SWSERIAL_TIMER_IRQ_PRIO 1
#endif
#endif
#ifdef STM32F0xx
#define HAL_TIMER_RATE (F_CPU) // Frequency of timer peripherals
#define MCU_STEP_TIMER 16
@@ -175,4 +179,8 @@ TIM_TypeDef * HAL_timer_device(const uint8_t timer_num) {
return nullptr;
}
void SetSoftwareSerialTimerInterruptPriority() {
TERN_(HAS_TMC_SW_SERIAL, SoftwareSerial::setInterruptPriority(SWSERIAL_TIMER_IRQ_PRIO, 0));
}
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC