mirror of https://github.com/ARMmbed/mbed-os.git
[STM32F7XX] Fix timer interrupt handler
parent
db49b362e9
commit
67ef32c51a
|
@ -45,13 +45,16 @@ void us_ticker_irq_handler(void);
|
||||||
|
|
||||||
void timer_irq_handler(void) {
|
void timer_irq_handler(void) {
|
||||||
// Channel 1 for mbed timeout
|
// Channel 1 for mbed timeout
|
||||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||||
|
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||||
us_ticker_irq_handler();
|
us_ticker_irq_handler();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Channel 2 for HAL tick
|
// Channel 2 for HAL tick
|
||||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
|
||||||
|
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
||||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||||
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||||
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
||||||
|
@ -66,6 +69,7 @@ void timer_irq_handler(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reconfigure the HAL tick using a standard timer instead of systick.
|
// Reconfigure the HAL tick using a standard timer instead of systick.
|
||||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||||
|
|
|
@ -45,13 +45,16 @@ void us_ticker_irq_handler(void);
|
||||||
|
|
||||||
void timer_irq_handler(void) {
|
void timer_irq_handler(void) {
|
||||||
// Channel 1 for mbed timeout
|
// Channel 1 for mbed timeout
|
||||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||||
|
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||||
us_ticker_irq_handler();
|
us_ticker_irq_handler();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Channel 2 for HAL tick
|
// Channel 2 for HAL tick
|
||||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
|
||||||
|
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
||||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||||
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||||
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
||||||
|
@ -66,6 +69,7 @@ void timer_irq_handler(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reconfigure the HAL tick using a standard timer instead of systick.
|
// Reconfigure the HAL tick using a standard timer instead of systick.
|
||||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||||
|
|
|
@ -45,13 +45,16 @@ void us_ticker_irq_handler(void);
|
||||||
|
|
||||||
void timer_irq_handler(void) {
|
void timer_irq_handler(void) {
|
||||||
// Channel 1 for mbed timeout
|
// Channel 1 for mbed timeout
|
||||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||||
|
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||||
us_ticker_irq_handler();
|
us_ticker_irq_handler();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Channel 2 for HAL tick
|
// Channel 2 for HAL tick
|
||||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
|
||||||
|
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
||||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||||
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||||
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
||||||
|
@ -66,6 +69,7 @@ void timer_irq_handler(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reconfigure the HAL tick using a standard timer instead of systick.
|
// Reconfigure the HAL tick using a standard timer instead of systick.
|
||||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||||
|
|
Loading…
Reference in New Issue