8000 stm32/timer: Cannot specify timer callbacks using callback(). by yn386 · Pull Request #9182 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

stm32/timer: Cannot specify timer callbacks using callback(). #9182

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
8000
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ports/stm32/timer.c
80F1
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,7 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
switch (self->mode) {
case CHANNEL_MODE_PWM_NORMAL:
case CHANNEL_MODE_PWM_INVERTED:
HAL_TIM_PWM_Stop_IT(&self->timer->tim, TIMER_CHANNEL(self));
HAL_TIM_PWM_Start_IT(&self->timer->tim, TIMER_CHANNEL(self));
break;
case CHANNEL_MODE_OC_TIMING:
Expand All @@ -1584,9 +1585,11 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
case CHANNEL_MODE_OC_TOGGLE:
case CHANNEL_MODE_OC_FORCED_ACTIVE:
case CHANNEL_MODE_OC_FORCED_INACTIVE:
HAL_TIM_OC_Stop_IT(&self->timer->tim, TIMER_CHANNEL(self));
HAL_TIM_OC_Start_IT(&self->timer->tim, TIMER_CHANNEL(self));
break;
case CHANNEL_MODE_IC:
HAL_TIM_IC_Stop_IT(&self->timer->tim, TIMER_CHANNEL(self));
HAL_TIM_IC_Start_IT(&self->timer->tim, TIMER_CHANNEL(self));
break;
}
Expand Down
0