raiden00pl commented on code in PR #18864:
URL: https://github.com/apache/nuttx/pull/18864#discussion_r3225645306


##########
arch/arm/src/at32/at32_pwm.c:
##########
@@ -2168,11 +2168,6 @@ static int pwm_duty_update(struct pwm_lowerhalf_s *dev, 
uint8_t channel,
   pwminfo("TIM%u channel: %u duty: %08" PRIx32 "\n",
           priv->timid, channel, duty);
 
-#ifndef CONFIG_PWM_MULTICHAN

Review Comment:
   optimizing such a simple case is a matter for the compiler. when 
CONFIG_PWM_NCHANNELS=1 this code should be easy to optimise:
   
   ```
         for (i = 0; ret == OK && i < CONFIG_PWM_NCHANNELS; i++)
           {
             /* Break the loop if all following channels are not configured */
   
             if (info->channels[i].channel == -1)
               {
                 break;
               }
   
             /* Set output if channel configured */
   
             if (info->channels[i].channel != 0)
               {
                 ret = pwm_duty_update(dev, info->channels[i].channel,
                                       info->channels[i].duty);
               }
           }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to