Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58361589d8 |
+8
-2
@@ -76,9 +76,15 @@ void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
/* EXTI interrupt init*/
|
/* EXTI interrupt init
|
||||||
|
* Keep CH390 INT masked during early boot. PB0 may already be asserted at
|
||||||
|
* power-on, while the FreeRTOS semaphore is not created until
|
||||||
|
* MX_FREERTOS_Init(). The network driver enables EXTI0 after CH390 and the
|
||||||
|
* RTOS objects are ready.
|
||||||
|
*/
|
||||||
|
HAL_NVIC_DisableIRQ(EXTI0_IRQn);
|
||||||
|
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);
|
||||||
HAL_NVIC_SetPriority(EXTI0_IRQn, 6, 0);
|
HAL_NVIC_SetPriority(EXTI0_IRQn, 6, 0);
|
||||||
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "stm32f1xx_it.h"
|
#include "stm32f1xx_it.h"
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
#include "semphr.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
#include "app_runtime.h"
|
#include "app_runtime.h"
|
||||||
@@ -101,8 +102,11 @@ void EXTI0_IRQHandler(void)
|
|||||||
|
|
||||||
if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_0) != RESET) {
|
if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_0) != RESET) {
|
||||||
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);
|
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);
|
||||||
xSemaphoreGiveFromISR(xNetSemaphore, &xHigherPriorityTaskWoken);
|
if ((xNetSemaphore != NULL) &&
|
||||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
(xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)) {
|
||||||
|
xSemaphoreGiveFromISR(xNetSemaphore, &xHigherPriorityTaskWoken);
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,6 +188,8 @@ void ch390_interrupt_init(void)
|
|||||||
/* EXTI0 is configured in CubeMX for PB0 */
|
/* EXTI0 is configured in CubeMX for PB0 */
|
||||||
/* NVIC priority should be >= configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY */
|
/* NVIC priority should be >= configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY */
|
||||||
/* for FreeRTOS compatibility */
|
/* for FreeRTOS compatibility */
|
||||||
|
HAL_NVIC_DisableIRQ(EXTI0_IRQn);
|
||||||
|
__HAL_GPIO_EXTI_CLEAR_IT(CH390_INT_PIN);
|
||||||
HAL_NVIC_SetPriority(EXTI0_IRQn, 6, 0);
|
HAL_NVIC_SetPriority(EXTI0_IRQn, 6, 0);
|
||||||
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user