mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: marc@cpdesign.com.au
To: Marc Reilly <marc@cpdesign.com.au>, Jules Maselbas <jmaselbas@zdiv.net>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 1/3] commands: add pwm manipulation command
Date: Mon, 29 May 2023 21:03:52 +1000	[thread overview]
Message-ID: <8267577.NyiUUSuA9g@dev8> (raw)
In-Reply-To: <ZHRu-XrMGdZWLpk2@tour>

Hi,

Thanks for your comments. ..

> > +	if ((state.period_ns == 0)
> > +			&& (freq < 0) && (duty < 0) && (period < 0)) {
> > +		printf(" need to know some timing info; freq or dury/
period\n");
> 
> typo: s/dury/duty/
> 
> > +	    pwm_free(pwm);
> 
> indentation
> 


Fixed in v3

> > +		return COMMAND_ERROR_USAGE;
> > +	}
> > +
> > +	if (invert_polarity >= 0)
> > +		state.polarity = invert_polarity;
> > +
> > +	/* period */
> > +	if (freq > 0) {
> > +		state.p_enable = true;
> > +		state.period_ns = HZ_TO_NANOSECONDS(freq);
> > +		if (width < 0) {
> > +			width = 50;
> > +		}
> > +	} else if (period > 0) {
> > +		state.p_enable = true;
> > +		state.period_ns = period;
> > +	}
> > +
> > +	/* duty */
> > +	if (width >= 0) {
> > +		pwm_set_relative_duty_cycle(&state, width, 100);
> > +	} else if (duty >= 0) {
> > +		if (duty > state.period_ns)
> > +			printf(" warning: duty_ns is greater than 
period\n");
> > +
> > +		state.duty_ns = duty;
> > +	}
> > +
> > +	error = pwm_apply_state(pwm, &state);
> > +
> > +	if (stop > 0) {
> > +		state.p_enable = false;
> > +		error = pwm_apply_state(pwm, &state);
> > +	}
> > +
> > +	pwm_free(pwm);
> > +
> > +	return error;
> 
> nit: return 0
> 

This I didn't change - error is propagating return value of pwm_apply_state()

I also fixed your other comments for pwm_get (including the somewhat 
embarrassing ^S :/ )

Cheers
Marc






  reply	other threads:[~2023-05-29 11:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29  0:13 Adding PWM Commands Marc Reilly
2023-05-29  0:13 ` [PATCH v2 1/3] commands: add pwm manipulation command Marc Reilly
2023-05-29  9:23   ` Jules Maselbas
2023-05-29 11:03     ` marc [this message]
2023-05-29 12:18       ` Jules Maselbas
2023-05-29  0:13 ` [PATCH v2 2/3] commands: pwm: add pwm_get command Marc Reilly
2023-05-29  9:06   ` Jules Maselbas
2023-05-29  0:13 ` [PATCH v2 3/3] include: pwm: minor function doc fix for pwm_set_relative_duty_cycle() Marc Reilly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8267577.NyiUUSuA9g@dev8 \
    --to=marc@cpdesign.com.au \
    --cc=barebox@lists.infradead.org \
    --cc=jmaselbas@zdiv.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox