Allow pins override of *_TIMER_NUM and HAL_*_TIMER_ISR (#18128)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
@ -21,15 +21,13 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "HAL.h"
|
||||
#include "timers.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include <rom/rtc.h>
|
||||
#include <driver/adc.h>
|
||||
#include <esp_adc_cal.h>
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include "wifi.h"
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include "watchdog.h"
|
||||
#include "i2s.h"
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include "WebSocketSerial.h"
|
||||
#endif
|
||||
|
@ -22,13 +22,12 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "HAL.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include <pins_arduino.h>
|
||||
#include "spi_pins.h"
|
||||
#include <SPI.h>
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
#include <pins_arduino.h>
|
||||
#include <SPI.h>
|
||||
|
||||
// ------------------------
|
||||
// Public Variables
|
||||
|
@ -27,9 +27,7 @@
|
||||
#include <driver/periph_ctrl.h>
|
||||
#include <driver/timer.h>
|
||||
|
||||
#include "HAL.h"
|
||||
|
||||
#include "timers.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
// ------------------------
|
||||
// Local defines
|
||||
|
@ -38,10 +38,18 @@
|
||||
typedef uint64_t hal_timer_t;
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFFFFFFFFFFULL
|
||||
|
||||
#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 PWM_TIMER_NUM 2 // index of timer to use for PWM outputs
|
||||
#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
|
||||
#ifndef PWM_TIMER_NUM
|
||||
#define PWM_TIMER_NUM 2 // index of timer to use for PWM outputs
|
||||
#endif
|
||||
|
||||
#define HAL_TIMER_RATE APB_CLK_FREQ // frequency of timer peripherals
|
||||
|
||||
@ -79,9 +87,15 @@ typedef uint64_t hal_timer_t;
|
||||
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
|
||||
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
|
||||
|
||||
#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler()
|
||||
#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler()
|
||||
#define HAL_PWM_TIMER_ISR() extern "C" void pwmTC_Handler()
|
||||
#ifndef HAL_TEMP_TIMER_ISR
|
||||
#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler()
|
||||
#endif
|
||||
#ifndef HAL_STEP_TIMER_ISR
|
||||
#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler()
|
||||
#endif
|
||||
#ifndef HAL_PWM_TIMER_ISR
|
||||
#define HAL_PWM_TIMER_ISR() extern "C" void pwmTC_Handler()
|
||||
#endif
|
||||
|
||||
extern "C" void tempTC_Handler();
|
||||
extern "C" void stepTC_Handler();
|
||||
|
Reference in New Issue
Block a user