Skip to content

Commit 3cac528

Browse files
Merge pull request #23 from sensometafisico/master
BXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK auto retrieve
2 parents 2f05778 + e4dc9de commit 3cac528

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

stm32/libcanard/bxcan/src/bxcan.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515

1616
/// Configure the system core clock frequency in Hz.
1717
/// Only used by the busy wait in waitMSRINAKBitStateChange().
18-
#if !defined(BXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK)
19-
# error "Please set BXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK to the current system core clock."
18+
/// If using official HAL from ST, set to global variable SystemCoreClock
19+
#if defined(USE_HAL_DRIVER) && USE_HAL_DRIVER
20+
extern uint32_t SystemCoreClock;
21+
# define BXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK SystemCoreClock
22+
#else
23+
# if !defined(BXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK)
24+
# error "Please set BXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK to the current system core clock."
25+
# endif
2026
#endif
2127

2228
/// By default, this macro resolves to the standard assert(). The user can redefine this if necessary.

0 commit comments

Comments
 (0)