Lines Matching refs:timer
90 TIM_TypeDef *timer; member
337 if (!IS_TIM_32B_COUNTER_INSTANCE(cfg->timer) && in pwm_stm32_set_cycles()
344 if (LL_TIM_IsEnabledIT_CC1(cfg->timer) || LL_TIM_IsEnabledIT_CC2(cfg->timer) || in pwm_stm32_set_cycles()
345 LL_TIM_IsEnabledIT_CC3(cfg->timer) || LL_TIM_IsEnabledIT_CC4(cfg->timer)) { in pwm_stm32_set_cycles()
374 LL_TIM_CC_DisableChannel(cfg->timer, current_ll_channel); in pwm_stm32_set_cycles()
393 if (!LL_TIM_CC_IsEnabledChannel(cfg->timer, current_ll_channel)) { in pwm_stm32_set_cycles()
407 oc_init.OCState = LL_TIM_CC_IsEnabledChannel(cfg->timer, ll_channel) in pwm_stm32_set_cycles()
410 oc_init.OCPolarity = LL_TIM_OC_GetPolarity(cfg->timer, ll_channel); in pwm_stm32_set_cycles()
418 LL_TIM_CC_IsEnabledChannel(cfg->timer, negative_ll_channel) in pwm_stm32_set_cycles()
422 LL_TIM_OC_GetPolarity(cfg->timer, negative_ll_channel); in pwm_stm32_set_cycles()
433 if (IS_TIM_SLAVE_INSTANCE(cfg->timer)) { in pwm_stm32_set_cycles()
434 LL_TIM_SetSlaveMode(cfg->timer, in pwm_stm32_set_cycles()
436 LL_TIM_SetTriggerInput(cfg->timer, LL_TIM_TS_ITR0); in pwm_stm32_set_cycles()
437 LL_TIM_DisableMasterSlaveMode(cfg->timer); in pwm_stm32_set_cycles()
442 if (LL_TIM_OC_Init(cfg->timer, ll_channel, &oc_init) != SUCCESS) { in pwm_stm32_set_cycles()
447 LL_TIM_EnableARRPreload(cfg->timer); in pwm_stm32_set_cycles()
449 LL_TIM_OC_EnablePreload(cfg->timer, ll_channel); in pwm_stm32_set_cycles()
450 LL_TIM_SetAutoReload(cfg->timer, period_cycles); in pwm_stm32_set_cycles()
451 LL_TIM_GenerateEvent_UPDATE(cfg->timer); in pwm_stm32_set_cycles()
454 LL_TIM_OC_SetPolarity(cfg->timer, current_ll_channel, get_polarity(flags)); in pwm_stm32_set_cycles()
455 set_timer_compare[channel - 1u](cfg->timer, pulse_cycles); in pwm_stm32_set_cycles()
456 LL_TIM_SetAutoReload(cfg->timer, period_cycles); in pwm_stm32_set_cycles()
478 if (LL_TIM_IC_Init(cfg->timer, ch2ll[channel - 1], &ic) != SUCCESS) { in init_capture_channels()
487 if (LL_TIM_IC_Init(cfg->timer, ch2ll[complimentary_channel[channel] - 1], &ic) != SUCCESS) { in init_capture_channels()
530 if (LL_TIM_IsEnabledIT_CC1(cfg->timer) || LL_TIM_IsEnabledIT_CC2(cfg->timer) || in pwm_stm32_configure_capture()
531 LL_TIM_IsEnabledIT_CC3(cfg->timer) || LL_TIM_IsEnabledIT_CC4(cfg->timer)) { in pwm_stm32_configure_capture()
541 if (!cfg->four_channel_capture_support && !IS_TIM_SLAVE_INSTANCE(cfg->timer)) { in pwm_stm32_configure_capture()
554 LL_TIM_SetSlaveMode(cfg->timer, LL_TIM_SLAVEMODE_DISABLED); in pwm_stm32_configure_capture()
563 LL_TIM_SetTriggerInput(cfg->timer, LL_TIM_TS_TI1FP1); in pwm_stm32_configure_capture()
565 LL_TIM_SetTriggerInput(cfg->timer, LL_TIM_TS_TI2FP2); in pwm_stm32_configure_capture()
567 LL_TIM_SetSlaveMode(cfg->timer, LL_TIM_SLAVEMODE_RESET); in pwm_stm32_configure_capture()
570 LL_TIM_EnableARRPreload(cfg->timer); in pwm_stm32_configure_capture()
571 if (!IS_TIM_32B_COUNTER_INSTANCE(cfg->timer)) { in pwm_stm32_configure_capture()
572 LL_TIM_SetAutoReload(cfg->timer, 0xffffu); in pwm_stm32_configure_capture()
574 LL_TIM_SetAutoReload(cfg->timer, 0xffffffffu); in pwm_stm32_configure_capture()
576 LL_TIM_EnableUpdateEvent(cfg->timer); in pwm_stm32_configure_capture()
599 if (LL_TIM_IsEnabledIT_CC1(cfg->timer) || LL_TIM_IsEnabledIT_CC2(cfg->timer) || in pwm_stm32_enable_capture()
600 LL_TIM_IsEnabledIT_CC3(cfg->timer) || LL_TIM_IsEnabledIT_CC4(cfg->timer)) { in pwm_stm32_enable_capture()
615 clear_capture_interrupt[channel - 1](cfg->timer); in pwm_stm32_enable_capture()
616 LL_TIM_ClearFlag_UPDATE(cfg->timer); in pwm_stm32_enable_capture()
618 LL_TIM_SetUpdateSource(cfg->timer, LL_TIM_UPDATESOURCE_COUNTER); in pwm_stm32_enable_capture()
620 enable_capture_interrupt[channel - 1](cfg->timer); in pwm_stm32_enable_capture()
622 LL_TIM_CC_EnableChannel(cfg->timer, ch2ll[channel - 1]); in pwm_stm32_enable_capture()
623 LL_TIM_CC_EnableChannel(cfg->timer, ch2ll[complimentary_channel[channel] - 1]); in pwm_stm32_enable_capture()
624 LL_TIM_EnableIT_UPDATE(cfg->timer); in pwm_stm32_enable_capture()
625 LL_TIM_GenerateEvent_UPDATE(cfg->timer); in pwm_stm32_enable_capture()
646 LL_TIM_SetUpdateSource(cfg->timer, LL_TIM_UPDATESOURCE_REGULAR); in pwm_stm32_disable_capture()
648 disable_capture_interrupt[channel - 1](cfg->timer); in pwm_stm32_disable_capture()
650 LL_TIM_DisableIT_UPDATE(cfg->timer); in pwm_stm32_disable_capture()
651 LL_TIM_CC_DisableChannel(cfg->timer, ch2ll[channel - 1]); in pwm_stm32_disable_capture()
652 LL_TIM_CC_DisableChannel(cfg->timer, ch2ll[complimentary_channel[channel] - 1]); in pwm_stm32_disable_capture()
665 if (LL_TIM_IsActiveFlag_UPDATE(cfg->timer)) { in pwm_stm32_isr()
666 LL_TIM_ClearFlag_UPDATE(cfg->timer); in pwm_stm32_isr()
669 if (LL_TIM_IsActiveFlag_CC1(cfg->timer) in pwm_stm32_isr()
670 || LL_TIM_IsActiveFlag_CC2(cfg->timer) in pwm_stm32_isr()
671 || LL_TIM_IsActiveFlag_CC3(cfg->timer) in pwm_stm32_isr()
672 || LL_TIM_IsActiveFlag_CC4(cfg->timer)) { in pwm_stm32_isr()
673 LL_TIM_ClearFlag_CC1(cfg->timer); in pwm_stm32_isr()
674 LL_TIM_ClearFlag_CC2(cfg->timer); in pwm_stm32_isr()
675 LL_TIM_ClearFlag_CC3(cfg->timer); in pwm_stm32_isr()
676 LL_TIM_ClearFlag_CC4(cfg->timer); in pwm_stm32_isr()
683 if (LL_TIM_IsActiveFlag_UPDATE(cfg->timer)) { in pwm_stm32_isr()
684 LL_TIM_ClearFlag_UPDATE(cfg->timer); in pwm_stm32_isr()
695 if (is_capture_active[cpt->channel - 1](cfg->timer) || in pwm_stm32_isr()
696 is_capture_active[complimentary_channel[cpt->channel] - 1](cfg->timer)) { in pwm_stm32_isr()
697 clear_capture_interrupt[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
699 [complimentary_channel[cpt->channel] - 1](cfg->timer); in pwm_stm32_isr()
701 cpt->period = get_channel_capture[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
703 [complimentary_channel[cpt->channel] - 1](cfg->timer); in pwm_stm32_isr()
707 is_capture_active[cpt->channel - 1](cfg->timer)) { in pwm_stm32_isr()
718 LL_TIM_GenerateEvent_UPDATE(cfg->timer); in pwm_stm32_isr()
722 is_capture_active[cpt->channel - 1](cfg->timer)) { in pwm_stm32_isr()
728 (cfg->timer); in pwm_stm32_isr()
729 cpt->period = get_channel_capture[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
732 clear_capture_interrupt[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
827 if (LL_TIM_Init(cfg->timer, &init) != SUCCESS) { in pwm_stm32_init()
834 if (IS_TIM_BREAK_INSTANCE(cfg->timer)) { in pwm_stm32_init()
835 LL_TIM_EnableAllOutputs(cfg->timer); in pwm_stm32_init()
839 LL_TIM_EnableCounter(cfg->timer); in pwm_stm32_init()
900 .timer = (TIM_TypeDef *)DT_REG_ADDR(PWM(index)), \
903 .pclken = DT_INST_CLK(index, timer), \