This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 00128ff2fe pwm: fix incorrect documentation for 
PWMIOC_SETCHARACTERISTICS IOCTL
00128ff2fe is described below

commit 00128ff2febd444aa1ec091b5f37f9896692b2cb
Author: Michal Lenc <[email protected]>
AuthorDate: Wed Aug 23 17:04:03 2023 +0200

    pwm: fix incorrect documentation for PWMIOC_SETCHARACTERISTICS IOCTL
    
    Documentation for PWMIOC_SETCHARACTERISTICS ioctl command mentioned
    that this command will neither start nor stop the pulsed output. This
    however is incorrect as PWMIOC_SETCHARACTERISTICS command leads to
    pwm_start() function which starts the pulsed output.
    
    While this might not be the correct behaviour (I would probably welcome
    the option to set PWM characteristics without starting the pulsed output)
    it is the way the PWM driver is coded for many architectures. Future
    enhancement might be to add function pwm_setchar() for example to just
    set characteristics without starting the PWM output.
    
    Signed-off-by: Michal Lenc <[email protected]>
---
 drivers/timers/pwm.c       |  4 +---
 include/nuttx/timers/pwm.h | 10 ++++------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/timers/pwm.c b/drivers/timers/pwm.c
index b6b3be36a1..9e627fdcde 100644
--- a/drivers/timers/pwm.c
+++ b/drivers/timers/pwm.c
@@ -437,9 +437,7 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   switch (cmd)
     {
       /* PWMIOC_SETCHARACTERISTICS - Set the characteristics of the next
-       *   pulsed output.  This command will neither start nor stop the
-       *   pulsed output.  It will either setup the configuration that will
-       *   be used when the output is started; or it will change the
+       *   pulsed output and start the pulsed output. It will change the
        *   characteristics of the pulsed output on the fly if the timer is
        *   already started.
        *
diff --git a/include/nuttx/timers/pwm.h b/include/nuttx/timers/pwm.h
index e18b9600d4..d19153e07e 100644
--- a/include/nuttx/timers/pwm.h
+++ b/include/nuttx/timers/pwm.h
@@ -79,12 +79,10 @@
  * interface, the majority of the functionality is implemented in driver
  * ioctl calls.  The PWM ioctl commands are listed below:
  *
- * PWMIOC_SETCHARACTERISTICS - Set the characteristics of the next pulsed
- *  output.  This command will neither start nor stop the pulsed output.
- *  It will either setup the configuration that will be used when the
- *  output is started; or it will change the characteristics of the pulsed
- *  output on the fly if the timer is already started.  This command will
- *  set the PWM characteristics and return immediately.
+ * PWMIOC_SETCHARACTERISTICS - Set the characteristics of the next
+ *  pulsed output and start the pulsed output. It will change the
+ *  characteristics of the pulsed output on the fly if the timer is
+ *  already started.
  *
  *  ioctl argument: A read-only reference to struct pwm_info_s that provides
  *  the characteristics of the pulsed output.

Reply via email to