Lines Matching refs:channel

63 	uint8_t channel;  member
312 static int pwm_stm32_set_cycles(const struct device *dev, uint32_t channel, in pwm_stm32_set_cycles() argument
322 if (channel < 1u || channel > TIMER_MAX_CH) { in pwm_stm32_set_cycles()
323 LOG_ERR("Invalid channel (%d)", channel); in pwm_stm32_set_cycles()
345 ll_channel = ch2ll[channel - 1u]; in pwm_stm32_set_cycles()
347 if (channel <= ARRAY_SIZE(ch2ll_n)) { in pwm_stm32_set_cycles()
348 negative_ll_channel = ch2ll_n[channel - 1u]; in pwm_stm32_set_cycles()
359 LOG_ERR("Channel %d has NO complementary output", channel); in pwm_stm32_set_cycles()
449 set_timer_compare[channel - 1u](cfg->timer, pulse_cycles); in pwm_stm32_set_cycles()
457 static int init_capture_channels(const struct device *dev, uint32_t channel, in init_capture_channels() argument
472 if (LL_TIM_IC_Init(cfg->timer, ch2ll[channel - 1], &ic) != SUCCESS) { in init_capture_channels()
481 if (LL_TIM_IC_Init(cfg->timer, ch2ll[complimentary_channel[channel] - 1], &ic) != SUCCESS) { in init_capture_channels()
490 uint32_t channel, pwm_flags_t flags, in pwm_stm32_configure_capture() argument
513 if ((channel != 1u) && (channel != 2u)) { in pwm_stm32_configure_capture()
518 if ((channel < 1u) || (channel > 4u)) { in pwm_stm32_configure_capture()
550 ret = init_capture_channels(dev, channel, flags); in pwm_stm32_configure_capture()
556 if (channel == 1u) { in pwm_stm32_configure_capture()
575 static int pwm_stm32_enable_capture(const struct device *dev, uint32_t channel) in pwm_stm32_enable_capture() argument
582 if ((channel != 1u) && (channel != 2u)) { in pwm_stm32_enable_capture()
587 if ((channel < 1u) || (channel > 4u)) { in pwm_stm32_enable_capture()
604 cpt->channel = channel; in pwm_stm32_enable_capture()
609 clear_capture_interrupt[channel - 1](cfg->timer); in pwm_stm32_enable_capture()
614 enable_capture_interrupt[channel - 1](cfg->timer); in pwm_stm32_enable_capture()
616 LL_TIM_CC_EnableChannel(cfg->timer, ch2ll[channel - 1]); in pwm_stm32_enable_capture()
617 LL_TIM_CC_EnableChannel(cfg->timer, ch2ll[complimentary_channel[channel] - 1]); in pwm_stm32_enable_capture()
624 static int pwm_stm32_disable_capture(const struct device *dev, uint32_t channel) in pwm_stm32_disable_capture() argument
629 if ((channel != 1u) && (channel != 2u)) { in pwm_stm32_disable_capture()
634 if ((channel < 1u) || (channel > 4u)) { in pwm_stm32_disable_capture()
642 disable_capture_interrupt[channel - 1](cfg->timer); in pwm_stm32_disable_capture()
645 LL_TIM_CC_DisableChannel(cfg->timer, ch2ll[channel - 1]); in pwm_stm32_disable_capture()
646 LL_TIM_CC_DisableChannel(cfg->timer, ch2ll[complimentary_channel[channel] - 1]); in pwm_stm32_disable_capture()
689 if (is_capture_active[cpt->channel - 1](cfg->timer) || in pwm_stm32_isr()
690 is_capture_active[complimentary_channel[cpt->channel] - 1](cfg->timer)) { in pwm_stm32_isr()
691 clear_capture_interrupt[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
693 [complimentary_channel[cpt->channel] - 1](cfg->timer); in pwm_stm32_isr()
695 cpt->period = get_channel_capture[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
697 [complimentary_channel[cpt->channel] - 1](cfg->timer); in pwm_stm32_isr()
701 is_capture_active[cpt->channel - 1](cfg->timer)) { in pwm_stm32_isr()
716 is_capture_active[cpt->channel - 1](cfg->timer)) { in pwm_stm32_isr()
721 cpt->pulse = get_channel_capture[complimentary_channel[cpt->channel] - 1] in pwm_stm32_isr()
723 cpt->period = get_channel_capture[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
726 clear_capture_interrupt[cpt->channel - 1](cfg->timer); in pwm_stm32_isr()
739 pwm_stm32_disable_capture(dev, cpt->channel); in pwm_stm32_isr()
746 cpt->callback(dev, cpt->channel, cpt->capture_period ? cpt->period : 0u, in pwm_stm32_isr()
754 uint32_t channel, uint64_t *cycles) in pwm_stm32_get_cycles_per_sec() argument