mirror of https://github.com/ARMmbed/mbed-os.git
[NUCLEO_F401RE] Add missing IT flag reset + update system clock variable
parent
18cade6354
commit
a0d3da9a36
|
@ -42,6 +42,7 @@ void us_ticker_irq_handler(void);
|
|||
void timer_irq_handler(void) {
|
||||
// Channel 1 for mbed timeout
|
||||
if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||
us_ticker_irq_handler();
|
||||
}
|
||||
|
||||
|
|
|
@ -238,6 +238,9 @@ void pwmout_period_us(pwmout_t* obj, int us) {
|
|||
|
||||
__HAL_TIM_DISABLE(&TimHandle);
|
||||
|
||||
// Update the SystemCoreClock variable
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
TimHandle.Init.Period = us - 1;
|
||||
TimHandle.Init.Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick
|
||||
TimHandle.Init.ClockDivision = 0;
|
||||
|
|
Loading…
Reference in New Issue