Skip to content

Commit 0e1f5a7

Browse files
committed
[EXTI] Able to build without HAL module
Note: Interrupt API does not use the HAL EXTI module anyway API is cleaned with HAL_EXTI_MODULE_DISABLED Signed-off-by: Frederic Pillon <[email protected]>
1 parent 4e25050 commit 0e1f5a7

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

Diff for: cores/arduino/WInterrupts.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
void attachInterrupt(uint32_t pin, callback_function_t callback, uint32_t mode)
2626
{
27+
#if !defined(HAL_EXTI_MODULE_DISABLED)
2728
uint32_t it_mode;
2829
PinName p = digitalPinToPinName(pin);
2930
GPIO_TypeDef *port = set_GPIO_Port_Clock(STM_PORT(p));
@@ -53,20 +54,36 @@ void attachInterrupt(uint32_t pin, callback_function_t callback, uint32_t mode)
5354
#endif /* STM32F1xx */
5455

5556
stm32_interrupt_enable(port, STM_GPIO_PIN(p), callback, it_mode);
57+
#else
58+
UNUSED(pin);
59+
UNUSED(callback);
60+
UNUSED(mode);
61+
#endif
5662
}
5763

5864
void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode)
5965
{
66+
#if !defined(HAL_EXTI_MODULE_DISABLED)
6067
callback_function_t _c = callback;
6168
attachInterrupt(pin, _c, mode);
69+
#else
70+
UNUSED(pin);
71+
UNUSED(callback);
72+
UNUSED(mode);
73+
#endif
74+
6275
}
6376

6477
void detachInterrupt(uint32_t pin)
6578
{
79+
#if !defined(HAL_EXTI_MODULE_DISABLED)
6680
PinName p = digitalPinToPinName(pin);
6781
GPIO_TypeDef *port = get_GPIO_Port(STM_PORT(p));
6882
if (!port) {
6983
return;
7084
}
7185
stm32_interrupt_disable(port, STM_GPIO_PIN(p));
86+
#else
87+
UNUSED(pin);
88+
#endif
7289
}

Diff for: cores/arduino/stm32/interrupt.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
*/
3838
#include "interrupt.h"
3939

40+
#if !defined(HAL_EXTI_MODULE_DISABLED)
41+
4042
/* Private Types */
4143

4244
/*As we can have only one interrupt/pin id, don't need to get the port info*/
@@ -370,5 +372,6 @@ void EXTI15_10_IRQHandler(void)
370372
#ifdef __cplusplus
371373
}
372374
#endif
375+
#endif /* !HAL_EXTI_MODULE_DISABLED */
373376
#endif
374377
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Diff for: cores/arduino/stm32/interrupt.h

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
/* Includes ------------------------------------------------------------------*/
4343
#include "stm32_def.h"
4444

45+
#if !defined(HAL_EXTI_MODULE_DISABLED)
46+
4547
#if defined(STM32F3xx)
4648
#define EXTI2_IRQn EXTI2_TSC_IRQn
4749
#endif
@@ -67,6 +69,7 @@ void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, callback_function_
6769
/* Exported functions ------------------------------------------------------- */
6870
void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, void (*callback)(void), uint32_t mode);
6971
void stm32_interrupt_disable(GPIO_TypeDef *port, uint16_t pin);
72+
#endif /* !HAL_EXTI_MODULE_DISABLED */
7073

7174
#endif /* __INTERRUPT_H */
7275

Diff for: cores/arduino/stm32/stm32yyxx_hal_conf.h

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@
5353
#undef HAL_DAC_MODULE_ENABLED
5454
#endif
5555

56+
/* Note: interrupt API does not used HAL EXTI module */
57+
/* anyway API is cleaned with HAL_EXTI_MODULE_DISABLED */
58+
#if !defined(HAL_EXTI_MODULE_DISABLED)
59+
/*#define HAL_EXTI_MODULE_ENABLED*/
60+
#else
61+
#undef HAL_EXTI_MODULE_ENABLED
62+
#endif
63+
5664
#if !defined(HAL_ETH_MODULE_DISABLED)
5765
/*#define HAL_ETH_MODULE_ENABLED*/
5866
#else

0 commit comments

Comments
 (0)