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:35 UTC
[incubator-nuttx] 02/02: drivers/leds/ncp5623c&pca9635pw: Fix
nxstyle issues.
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;