Skip to content

Commit a8f5311

Browse files
committed
[MP1] Fix EXTI GPIO init
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 034fc01 commit a8f5311

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

cores/arduino/stm32/interrupt.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
******************************************************************************
3737
*/
3838
#include "interrupt.h"
39-
39+
#if defined(STM32MP1xx)
40+
#include "lock_resource.h"
41+
#endif
4042
#if !defined(HAL_EXTI_MODULE_DISABLED)
4143

4244
/* Private Types */
@@ -177,8 +179,16 @@ void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, callback_function_
177179

178180
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
179181

182+
#if defined(STM32MP1xx)
183+
PERIPH_LOCK(port);
184+
#endif
185+
180186
HAL_GPIO_Init(port, &GPIO_InitStruct);
181187

188+
#if defined(STM32MP1xx)
189+
PERIPH_UNLOCK(port);
190+
#endif
191+
182192
gpio_irq_conf[id].callback = callback;
183193

184194
// Enable and set EXTI Interrupt

cores/arduino/stm32/lock_resource.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
/* Includes ------------------------------------------------------------------*/
2424
#include "stm32_def.h"
2525

26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
2629

2730
/* Exported types ------------------------------------------------------------*/
2831
typedef enum {
@@ -42,8 +45,9 @@ typedef enum {
4245
LockResource_Status_t Periph_Lock(void *Peripheral, uint32_t Timeout);
4346
void Periph_Unlock(void *Peripheral);
4447

45-
46-
48+
#ifdef __cplusplus
49+
} // extern "C"
50+
#endif
4751

4852
#endif /* _LOCK_RESOURCE_H */
4953

0 commit comments

Comments
 (0)