Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52a1f6e

Browse filesBrowse files
committed
fix(HardwareTimer): handle FDCANx irq when shared with TIMx irq
Application have to declare the phfdcan1 and phfdcan2. Example: FDCAN_HandleTypeDef myhfdcan1; FDCAN_HandleTypeDef *phfdcan1 = &myhfdcan1; #if defined(FDCAN2_BASE) FDCAN_HandleTypeDef *phfdcan2 = NULL; #endif Fixes #2224. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent d4ce718 commit 52a1f6e
Copy full SHA for 52a1f6e

File tree

1 file changed

+34
-0
lines changed
Filter options

1 file changed

+34
-0
lines changed

‎libraries/SrcWrapper/src/HardwareTimer.cpp

Copy file name to clipboardExpand all lines: libraries/SrcWrapper/src/HardwareTimer.cpp
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
/* Private Variables */
3838
timerObj_t *HardwareTimer_Handle[TIMER_NUM] = {NULL};
3939

40+
#if defined(HAL_FDCAN_MODULE_ENABLED) && defined(STM32G0xx) && defined(FDCAN1_BASE)
41+
/* Pointer to a FDCAN_HandleTypeDef structure that contains
42+
* the configuration information for the specified FDCAN.
43+
* Application have to declare them properly to be able to call
44+
* the HAL_FDCAN_IRQHandler().
45+
*/
46+
extern FDCAN_HandleTypeDef *phfdcan1;
47+
#if defined(FDCAN2_BASE)
48+
extern FDCAN_HandleTypeDef *phfdcan2;
49+
#endif
50+
#endif
51+
4052
/**
4153
* @brief HardwareTimer constructor: make uninitialized timer
4254
* Before calling any methods, call setup to select and setup
@@ -1761,6 +1773,17 @@ extern "C" {
17611773
if (HardwareTimer_Handle[TIMER16_INDEX]) {
17621774
HAL_TIM_IRQHandler(&HardwareTimer_Handle[TIMER16_INDEX]->handle);
17631775
}
1776+
#if defined(HAL_FDCAN_MODULE_ENABLED) && defined(STM32G0xx) && defined(FDCAN1_BASE)
1777+
/* FDCAN1_IT0 and FDCAN2_IT0 Interrupt */
1778+
if ((phfdcan1) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN1_IT0) != RESET)) {
1779+
HAL_FDCAN_IRQHandler(phfdcan1);
1780+
}
1781+
#if defined(FDCAN2_BASE)
1782+
if ((phfdcan2) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN2_IT0) != RESET)) {
1783+
HAL_FDCAN_IRQHandler(phfdcan2);
1784+
}
1785+
#endif
1786+
#endif
17641787
}
17651788
#endif
17661789
#endif //TIM16_BASE
@@ -1776,6 +1799,17 @@ extern "C" {
17761799
if (HardwareTimer_Handle[TIMER17_INDEX]) {
17771800
HAL_TIM_IRQHandler(&HardwareTimer_Handle[TIMER17_INDEX]->handle);
17781801
}
1802+
#if defined(HAL_FDCAN_MODULE_ENABLED) && defined(STM32G0xx) && defined(FDCAN1_BASE)
1803+
/* FDCAN1_IT1 and FDCAN2_IT1 Interrupt */
1804+
if ((phfdcan1) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN1_IT1) != RESET)) {
1805+
HAL_FDCAN_IRQHandler(phfdcan1);
1806+
}
1807+
#if defined(FDCAN2_BASE)
1808+
if ((phfdcan2) && (__HAL_GET_PENDING_IT(HAL_ITLINE_FDCAN2_IT1) != RESET)) {
1809+
HAL_FDCAN_IRQHandler(phfdcan2);
1810+
}
1811+
#endif
1812+
#endif
17791813
}
17801814
#endif //TIM17_BASE
17811815

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.