Allow pins override of *_TIMER_NUM and HAL_*_TIMER_ISR (#18128)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
ellensp
2020-06-02 11:33:30 +12:00
committed by GitHub
parent 2bf63e29c6
commit 33d1e77e2e
43 changed files with 461 additions and 338 deletions

View File

@ -119,7 +119,6 @@
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
#endif
#include "timers.h"
/**
* TODO: review this to return 1 for pins that are not analog input

View File

@ -36,8 +36,9 @@
//
#if defined(PLATFORMIO) && defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "../../inc/MarlinConfig.h"
#include "SoftwareSerial.h"
#include "timers.h"
#define OVERSAMPLE 3 // in RX, Timer will generate interruption OVERSAMPLE time during a bit. Thus OVERSAMPLE ticks in a bit. (interrupt not synchonized with edge).

View File

@ -21,8 +21,6 @@
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "timers.h"
#include "../../inc/MarlinConfig.h"
// ------------------------

View File

@ -33,9 +33,15 @@
#define hal_timer_t uint32_t
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF // Timers can be 16 or 32 bit
#define STEP_TIMER_NUM 0 // index of timer to use for stepper
#define TEMP_TIMER_NUM 1 // index of timer to use for temperature
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#ifndef STEP_TIMER_NUM
#define STEP_TIMER_NUM 0 // Timer Index for Stepper
#endif
#ifndef PULSE_TIMER_NUM
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#endif
#ifndef TEMP_TIMER_NUM
#define TEMP_TIMER_NUM 1 // Timer Index for Temperature
#endif
#define TEMP_TIMER_FREQUENCY 1000 // Temperature::isr() is expected to be called at around 1kHz
@ -57,8 +63,13 @@
extern void Step_Handler(HardwareTimer *htim);
extern void Temp_Handler(HardwareTimer *htim);
#define HAL_STEP_TIMER_ISR() void Step_Handler(HardwareTimer *htim)
#define HAL_TEMP_TIMER_ISR() void Temp_Handler(HardwareTimer *htim)
#ifndef HAL_STEP_TIMER_ISR
#define HAL_STEP_TIMER_ISR() void Step_Handler(HardwareTimer *htim)
#endif
#ifndef HAL_TEMP_TIMER_ISR
#define HAL_TEMP_TIMER_ISR() void Temp_Handler(HardwareTimer *htim)
#endif
// ------------------------
// Public Variables