Add STEPPER_ISR_ENABLED() to HALs
Some also get a `HAL_timer_interrupt_enabled` function.
This commit is contained in:
@ -75,6 +75,14 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num) {
|
||||
}
|
||||
}
|
||||
|
||||
bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
|
||||
switch (timer_num) {
|
||||
case 0: return NVIC_GetActive(TIMER0_IRQn);
|
||||
case 1: return NVIC_GetActive(TIMER1_IRQn);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void HAL_timer_isr_prologue(const uint8_t timer_num) {
|
||||
switch (timer_num) {
|
||||
case 0: SBI(LPC_TIM0->IR, 0); break; // Clear the Interrupt
|
||||
|
@ -58,6 +58,8 @@ typedef uint32_t hal_timer_t;
|
||||
|
||||
#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
|
||||
#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
|
||||
#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
|
||||
|
||||
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
|
||||
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
|
||||
|
||||
@ -125,6 +127,7 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_current_count(const uint8_t timer_
|
||||
|
||||
void HAL_timer_enable_interrupt(const uint8_t timer_num);
|
||||
void HAL_timer_disable_interrupt(const uint8_t timer_num);
|
||||
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
|
||||
void HAL_timer_isr_prologue(const uint8_t timer_num);
|
||||
|
||||
#endif // _HAL_TIMERS_DUE_H
|
||||
|
Reference in New Issue
Block a user