🩹 Teensy 4.x timer mods
This commit is contained in:
@@ -55,15 +55,19 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
GPT1_OCR1 = (GPT1_TIMER_RATE / frequency) - 1;
|
||||
|
||||
// Enable compare‑event interrupt
|
||||
GPT1_IR = GPT_IR_OF1IE; // OF2 interrupt enabled
|
||||
GPT1_CR |= GPT_CR_EN; //enable GPT2 counting at 150 MHz
|
||||
GPT1_IR = GPT_IR_OF1IE; // OF1 interrupt enabled
|
||||
|
||||
OUT_WRITE(15, HIGH);
|
||||
// Pull Pin 15 HIGH (logic‑high is the “idle” state)
|
||||
TERN_(MARLIN_DEV_MODE, OUT_WRITE(15, HIGH));
|
||||
|
||||
// Attach and enable Stepper IRQ
|
||||
// Note: UART priority is 16
|
||||
attachInterruptVector(IRQ_GPT1, &stepTC_Handler);
|
||||
NVIC_SET_PRIORITY(IRQ_GPT1, 16); // Priority 16 (higher than Temp Timer)
|
||||
|
||||
// Start GPT1 counting at 150 MHz
|
||||
GPT1_CR |= GPT_CR_EN;
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
@@ -90,14 +94,18 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
GPT2_OCR1 = (GPT2_TIMER_RATE / frequency) - 1;
|
||||
|
||||
// Enable compare‑event interrupt
|
||||
GPT2_IR = GPT_IR_OF1IE;
|
||||
GPT2_CR |= GPT_CR_EN; //enable GPT2 counting at 150 MHz
|
||||
GPT2_IR = GPT_IR_OF1IE; // OF1 interrupt enabled
|
||||
|
||||
OUT_WRITE(14, HIGH);
|
||||
// Pull Pin 14 HIGH (logic‑high is the “idle” state)
|
||||
TERN_(MARLIN_DEV_MODE, OUT_WRITE(14, HIGH));
|
||||
|
||||
// Attach Temperature ISR
|
||||
attachInterruptVector(IRQ_GPT2, &tempTC_Handler);
|
||||
NVIC_SET_PRIORITY(IRQ_GPT2, 32); // Priority 32 (lower than Step Timer)
|
||||
|
||||
// Start GPT2 counting at 150 MHz
|
||||
GPT2_CR |= GPT_CR_EN;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user