Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed setting HardwareTimer interrupt priority #1062

Merged
merged 2 commits into from
May 13, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cores/arduino/HardwareTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
/* Private Variables */
timerObj_t *HardwareTimer_Handle[TIMER_NUM] = {NULL};

IRQn_Type getTimerUpIrq(TIM_TypeDef *tim);
IRQn_Type getTimerCCIrq(TIM_TypeDef *tim);

/**
* @brief HardwareTimer constructor: set default configuration values
* @param Timer instance ex: TIM1, ...
Expand Down Expand Up @@ -913,6 +910,10 @@ void HardwareTimer::setPWM(uint32_t channel, PinName pin, uint32_t frequency, ui
*/
void HardwareTimer::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriority)
{
// Set priority for immediate use
NVIC_SetPriority(getTimerUpIrq(_timerObj.handle.Instance), NVIC_EncodePriority(NVIC_GetPriorityGrouping(), preemptPriority, subPriority));

sjasonsmith marked this conversation as resolved.
Show resolved Hide resolved
// Store priority for use if timer is re-initialized
_timerObj.preemptPriority = preemptPriority;
_timerObj.subPriority = subPriority;
}
Expand Down