Skip to content

fix(HardwareTimer): handle FDCANx irq when shared with TIMx irq #2301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions libraries/SrcWrapper/src/HardwareTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@
/* Private Variables */
timerObj_t *HardwareTimer_Handle[TIMER_NUM] = {NULL};

#if defined(HAL_FDCAN_MODULE_ENABLED) && defined(STM32G0xx) && defined(FDCAN1_BASE)
/* Pointer to a FDCAN_HandleTypeDef structure that contains
* the configuration information for the specified FDCAN.
* Application have to declare them properly to be able to call
* the HAL_FDCAN_IRQHandler().
*/
extern FDCAN_HandleTypeDef *phfdcan1;
#if defined(FDCAN2_BASE)
extern FDCAN_HandleTypeDef *phfdcan2;
#endif
#endif

/**
* @brief HardwareTimer constructor: make uninitialized timer
* Before calling any methods, call setup to select and setup
Expand Down Expand Up @@ -1761,6 +1773,17 @@ extern "C" {
if (HardwareTimer_Handle[TIMER16_INDEX]) {
HAL_TIM_IRQHandler(&HardwareTimer_Handle[TIMER16_INDEX]->handle);
}
#if defined(HAL_FDCAN_MODULE_ENABLED) && defined(STM32G0xx) && defined(FDCAN1_BASE)
/* FDCAN1_IT0 and FDCAN2_IT0 Interrupt */
if ((phfdcan1) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN1_IT0) != RESET)) {
HAL_FDCAN_IRQHandler(phfdcan1);
}
#if defined(FDCAN2_BASE)
if ((phfdcan2) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN2_IT0) != RESET)) {
HAL_FDCAN_IRQHandler(phfdcan2);
}
#endif
#endif
}
#endif
#endif //TIM16_BASE
Expand All @@ -1776,6 +1799,17 @@ extern "C" {
if (HardwareTimer_Handle[TIMER17_INDEX]) {
HAL_TIM_IRQHandler(&HardwareTimer_Handle[TIMER17_INDEX]->handle);
}
#if defined(HAL_FDCAN_MODULE_ENABLED) && defined(STM32G0xx) && defined(FDCAN1_BASE)
/* FDCAN1_IT1 and FDCAN2_IT1 Interrupt */
if ((phfdcan1) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN1_IT1) != RESET)) {
HAL_FDCAN_IRQHandler(phfdcan1);
}
#if defined(FDCAN2_BASE)
if ((phfdcan2) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN2_IT1) != RESET)) {
HAL_FDCAN_IRQHandler(phfdcan2);
}
#endif
#endif
}
#endif //TIM17_BASE

Expand Down
Loading