You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/06/12 20:51:33 UTC

[incubator-nuttx] branch master updated (0acf6da -> 02ad0e9)

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

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 0acf6da  drivers/analog/ and include/nuttx/analog: Fix typos and nxstyle issues.
     new ebfc12d  drivers/: Fix some drivers mode priviliges.  It's not used but it's better to get it right.
     new 02ad0e9  drivers/leds/ncp5623c&pca9635pw: Fix nxstyle issues.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/analog/dac.c           |  2 +-
 drivers/leds/ncp5623c.c        | 10 ++++++----
 drivers/leds/pca9635pw.c       | 43 +++++++++++++++++++++++-------------------
 include/nuttx/leds/pca9635pw.h | 23 +++++++++++-----------
 4 files changed, 43 insertions(+), 35 deletions(-)


[incubator-nuttx] 02/02: drivers/leds/ncp5623c&pca9635pw: Fix nxstyle issues.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 02ad0e909421e8a3d2a18f0663cebe86011d0148
Author: Ouss4 <ab...@gmail.com>
AuthorDate: Fri Jun 12 15:56:26 2020 +0100

    drivers/leds/ncp5623c&pca9635pw: Fix nxstyle issues.
---
 drivers/leds/ncp5623c.c        |  8 +++++---
 drivers/leds/pca9635pw.c       | 41 +++++++++++++++++++++++------------------
 include/nuttx/leds/pca9635pw.h | 23 ++++++++++++-----------
 3 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/drivers/leds/ncp5623c.c b/drivers/leds/ncp5623c.c
index 1576bfb..31b1f1f 100644
--- a/drivers/leds/ncp5623c.c
+++ b/drivers/leds/ncp5623c.c
@@ -68,7 +68,8 @@ static int ncp5623c_i2c_write_byte(FAR struct ncp5623c_dev_s *priv,
 
 static int ncp5623c_open(FAR struct file *filep);
 static int ncp5623c_close(FAR struct file *filep);
-static int ncp5623c_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static int ncp5623c_ioctl(FAR struct file *filep, int cmd,
+                          unsigned long arg);
 static ssize_t ncp5623c_read(FAR struct file *filep, FAR char *buffer,
                  size_t buflen);
 static ssize_t ncp5623c_write(FAR struct file *filep, FAR const char *buffer,
@@ -162,7 +163,7 @@ static int ncp5623c_open(FAR struct file *filep)
 
   /* Set up Max current */
 
-  ret = ncp5623c_i2c_write_byte(priv, NCP5623C_ILED, 0x1F);
+  ret = ncp5623c_i2c_write_byte(priv, NCP5623C_ILED, 0x1f);
   if (ret != OK)
     {
       lcderr("ERROR: Could not set up max current\n");
@@ -204,7 +205,8 @@ static int ncp5623c_close(FAR struct file *filep)
  * Name: ncp5623c_ioctl
  *
  * Description:
- *   This function is called whenever an ioctl call to a NCP5623C is performed.
+ *   This function is called whenever an ioctl call to a NCP5623C is
+ *   performed.
  *
  ****************************************************************************/
 
diff --git a/drivers/leds/pca9635pw.c b/drivers/leds/pca9635pw.c
index d3dfebf..87f7ec2 100644
--- a/drivers/leds/pca9635pw.c
+++ b/drivers/leds/pca9635pw.c
@@ -71,7 +71,8 @@ static int pca9635pw_set_led_mode(FAR struct pca9635pw_dev_s *priv,
 
 static int pca9635pw_open(FAR struct file *filep);
 static int pca9635pw_close(FAR struct file *filep);
-static int pca9635pw_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static int pca9635pw_ioctl(FAR struct file *filep, int cmd,
+                           unsigned long arg);
 
 /****************************************************************************
  * Private Data
@@ -123,8 +124,8 @@ static int pca9635pw_i2c_write_byte(FAR struct pca9635pw_dev_s *priv,
 
   /* Write the register address followed by the data (no RESTART) */
 
-  lcdinfo("i2c addr: 0x%02X reg addr: 0x%02X value: 0x%02X\n", priv->i2c_addr,
-          buffer[0], buffer[1]);
+  lcdinfo("i2c addr: 0x%02X reg addr: 0x%02X value: 0x%02X\n",
+          priv->i2c_addr, buffer[0], buffer[1]);
 
   ret = i2c_write(priv->i2c, &config, buffer, BUFFER_SIZE);
   if (ret < 0)
@@ -140,7 +141,8 @@ static int pca9635pw_i2c_write_byte(FAR struct pca9635pw_dev_s *priv,
  * Name: pca9635pw_set_led_mode
  *
  * Description:
- *   Set the led output mode (see PCA9635PW_LED_OUT_x register value definitions)
+ *   Set the led output mode (see PCA9635PW_LED_OUT_x register value
+ *   definitions)
  *
  ****************************************************************************/
 
@@ -210,8 +212,8 @@ static int pca9635pw_open(FAR struct file *filep)
     }
 
   /* A delay of 500 us is necessary since this is the maximum time which the
-   * oscillator of the PCA9635PW needs to be up and running once sleep mode was
-   * left.
+   * oscillator of the PCA9635PW needs to be up and running once sleep mode
+   * was left.
    */
 
   nxsig_usleep(500);
@@ -220,11 +222,11 @@ static int pca9635pw_open(FAR struct file *filep)
    * by the individual pwm registers.
    */
 
-  ret = pca9635pw_set_led_mode(priv, PCA9635PW_LED_OUT_x_MODE_2);
+  ret = pca9635pw_set_led_mode(priv, PCA9635PW_LED_OUT_X_MODE_2);
   if (ret < 0)
     {
-      lcderr("ERROR: Could not set led driver outputs to MODE2 (LED's brightness are "
-             "controlled by pwm registers)\n");
+      lcderr("ERROR: Could not set led driver outputs to MODE2"
+             " (LED's brightness are controlled by pwm registers)\n");
       return ret;
     }
 
@@ -247,10 +249,11 @@ static int pca9635pw_close(FAR struct file *filep)
 
   /* Turn all led drivers off */
 
-  ret = pca9635pw_set_led_mode(priv, PCA9635PW_LED_OUT_x_MODE_0);
+  ret = pca9635pw_set_led_mode(priv, PCA9635PW_LED_OUT_X_MODE_0);
   if (ret < 0)
     {
-      lcderr("ERROR: Could not set led driver outputs to MODE0 (LED's are off)\n");
+      lcderr("ERROR: Could not set led driver outputs to MODE0"
+             " (LED's are off)\n");
       return ret;
     }
 
@@ -258,7 +261,7 @@ static int pca9635pw_close(FAR struct file *filep)
 
   uint8_t const PCA9635PW_MODE_1_FINAL_VALUE = PCA9635PW_MODE_1_SLEEP;
 
-  ret =pca9635pw_i2c_write_byte(priv, PCA9635PW_MODE_1,
+  ret = pca9635pw_i2c_write_byte(priv, PCA9635PW_MODE_1,
                                 PCA9635PW_MODE_1_FINAL_VALUE);
   if (ret < 0)
     {
@@ -272,11 +275,13 @@ static int pca9635pw_close(FAR struct file *filep)
  * Name: pca9635pw_close
  *
  * Description:
- *   This function is called whenever an ioctl call to a PCA9635PW is performed.
+ *   This function is called whenever an ioctl call to a PCA9635PW is
+ *   performed.
  *
  ****************************************************************************/
 
-static int pca9635pw_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+static int pca9635pw_ioctl(FAR struct file *filep, int cmd,
+                           unsigned long arg)
 {
   FAR struct inode *inode = filep->f_inode;
   FAR struct pca9635pw_dev_s *priv = inode->i_private;
@@ -286,16 +291,16 @@ static int pca9635pw_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 
   switch (cmd)
     {
-      /* Set the brightness of an individual LED. Arg: pca9635pw_led_brightness_s
-       * pointer.
+      /* Set the brightness of an individual LED.
+       * Arg: pca9635pw_brightness_s pointer.
        */
 
     case PWMIOC_SETLED_BRIGHTNESS:
       {
         /* Retrieve the information handed over as argument for this ioctl */
 
-        FAR const struct pca9635pw_setled_brightness_arg_s *ptr =
-          (FAR const struct pca9635pw_setled_brightness_arg_s *)((uintptr_t)arg);
+        FAR const struct pca9635pw_brightness_s *ptr =
+          (FAR const struct pca9635pw_brightness_s *)((uintptr_t)arg);
 
         DEBUGASSERT(ptr != NULL);
 
diff --git a/include/nuttx/leds/pca9635pw.h b/include/nuttx/leds/pca9635pw.h
index 9872cb1..b30642c 100644
--- a/include/nuttx/leds/pca9635pw.h
+++ b/include/nuttx/leds/pca9635pw.h
@@ -107,14 +107,14 @@
 
 /* PCA9635PW_LED_OUT_x register value definitions */
 
-#define PCA9635PW_LED_OUT_x_MODE_0 (0x00)                     /* all led drivers are turned off */
-#define PCA9635PW_LED_OUT_x_MODE_1 (0x55)                     /* all led drivers are fully turned on */
-#define PCA9635PW_LED_OUT_x_MODE_2 (0xAA)                     /* all led drivers individual brightness can be controlled by their individual pwm registers */
-#define PCA9635PW_LED_OUT_x_MODE_3 (0xFF)                     /* all led drivers individual brightness and group dimming/blinking can be controlled by their individual pwm registers and the GRPPWM register */
+#define PCA9635PW_LED_OUT_X_MODE_0 (0x00)                     /* all led drivers are turned off */
+#define PCA9635PW_LED_OUT_X_MODE_1 (0x55)                     /* all led drivers are fully turned on */
+#define PCA9635PW_LED_OUT_X_MODE_2 (0xAA)                     /* all led drivers individual brightness can be controlled by their individual pwm registers */
+#define PCA9635PW_LED_OUT_X_MODE_3 (0xFF)                     /* all led drivers individual brightness and group dimming/blinking can be controlled by their individual pwm registers and the GRPPWM register */
 
 /* IOCTL commands */
 
-#define PWMIOC_SETLED_BRIGHTNESS   _PWMIOC(1)                 /* Arg: pca9635pw_setled_brightness_arg_s * pointer */
+#define PWMIOC_SETLED_BRIGHTNESS   _PWMIOC(1)                 /* Arg: pca9635pw_brightness_s * pointer */
 
 /****************************************************************************
  * Public Types
@@ -140,14 +140,15 @@ enum led_select_e
   LED_15 = PCA9635PW_LED_15
 };
 
-/* This structure is used in an IOCTL command for setting the PWM of an individual
- * LED. The desired LED is selected by setting the 'led' parameter accordingly
- * whereas the 'led_pwm' field governs the brightness of the selected LED. A value
- * of 0 (0x00) leads to a duty cycle of 0 % = LED off while a value of 255 (0xFF)
- * leads to a duty cycle of 99.6 % = Maximum brightness.
+/* This structure is used in an IOCTL command for setting the PWM of an
+ * individual LED. The desired LED is selected by setting the 'led'
+ * parameter accordingly whereas the 'led_pwm' field governs the brightness
+ * of the selected LED.
+ * A value of 0 (0x00) leads to a duty cycle of 0 % = LED off while a value
+ * of 255 (0xFF) leads to a duty cycle of 99.6 % = Maximum brightness.
  */
 
-struct pca9635pw_setled_brightness_arg_s
+struct pca9635pw_brightness_s
 {
   enum led_select_e led;
   uint8_t brightness;


[incubator-nuttx] 01/02: drivers/: Fix some drivers mode priviliges. It's not used but it's better to get it right.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ebfc12d3d293dc7a8b1fe6ccdda831bfedaf171b
Author: Ouss4 <ab...@gmail.com>
AuthorDate: Fri Jun 12 15:41:38 2020 +0100

    drivers/: Fix some drivers mode priviliges.  It's not used but it's
    better to get it right.
---
 drivers/analog/dac.c     | 2 +-
 drivers/leds/ncp5623c.c  | 2 +-
 drivers/leds/pca9635pw.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/analog/dac.c b/drivers/analog/dac.c
index 305110c..d2911e9 100644
--- a/drivers/analog/dac.c
+++ b/drivers/analog/dac.c
@@ -541,5 +541,5 @@ int dac_register(FAR const char *path, FAR struct dac_dev_s *dev)
 
   dev->ad_ops->ao_reset(dev);
 
-  return register_driver(path, &dac_fops, 0555, dev);
+  return register_driver(path, &dac_fops, 0222, dev);
 }
diff --git a/drivers/leds/ncp5623c.c b/drivers/leds/ncp5623c.c
index c1b1ea6..1576bfb 100644
--- a/drivers/leds/ncp5623c.c
+++ b/drivers/leds/ncp5623c.c
@@ -295,7 +295,7 @@ int ncp5623c_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
 
   /* Register the character driver */
 
-  int const ret = register_driver(devpath, &g_ncp5623c_fileops, 666, priv);
+  int const ret = register_driver(devpath, &g_ncp5623c_fileops, 0666, priv);
   if (ret != OK)
     {
       lcderr("ERROR: Failed to register driver: %d\n", ret);
diff --git a/drivers/leds/pca9635pw.c b/drivers/leds/pca9635pw.c
index 6b8d472..d3dfebf 100644
--- a/drivers/leds/pca9635pw.c
+++ b/drivers/leds/pca9635pw.c
@@ -363,7 +363,7 @@ int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
 
   /* Register the character driver */
 
-  int const ret = register_driver(devpath, &g_pca9635pw_fileops, 666, priv);
+  int const ret = register_driver(devpath, &g_pca9635pw_fileops, 0666, priv);
   if (ret != OK)
     {
       lcderr("ERROR: Failed to register driver: %d\n", ret);