You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/03/18 17:25:35 UTC

[incubator-nuttx] 02/02: drivers/lcd/pcf8574_lcd_backpack.c: Fix nxstyle issues.

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

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

commit 1ab71814c25e0bb5a8d05b3d2ce997af9cbd2625
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Wed Mar 18 11:24:10 2020 -0600

    drivers/lcd/pcf8574_lcd_backpack.c: Fix nxstyle issues.
---
 drivers/lcd/pcf8574_lcd_backpack.c | 61 +++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 28 deletions(-)

diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c
index 63a2ad3..e4b61fe 100644
--- a/drivers/lcd/pcf8574_lcd_backpack.c
+++ b/drivers/lcd/pcf8574_lcd_backpack.c
@@ -88,12 +88,13 @@
 
 struct pcf8574_lcd_dev_s
 {
-  FAR struct i2c_master_s *i2c; /* I2C interface */
+  FAR struct i2c_master_s *i2c;              /* I2C interface */
   struct pcf8574_lcd_backpack_config_s cfg;  /* gpio configuration */
-  uint8_t bl_bit;               /* current backlight bit */
-  uint8_t refs;                 /* Number of references */
-  uint8_t unlinked;             /* We are unlinked, so teardown on last close */
-  sem_t sem_excl;               /* mutex */
+  uint8_t bl_bit;                            /* current backlight bit */
+  uint8_t refs;                              /* Number of references */
+  uint8_t unlinked;                          /* We are unlinked, so teardown
+                                              * on last close */
+  sem_t sem_excl;                            /* mutex */
 };
 
 struct lcd_instream_s
@@ -280,8 +281,8 @@ static inline void addr2rc(FAR struct pcf8574_lcd_dev_s *priv, uint8_t addr,
 
   if (*col >= priv->cfg.cols)
     {
-      /* 4 line displays have third and fourth lines really as continuation of
-       * first and second.
+      /* 4 line displays have third and fourth lines really as continuation
+       * of the first and second.
        */
 
       *row += 2;
@@ -554,10 +555,10 @@ static void lcd_init(FAR struct pcf8574_lcd_dev_s *priv)
 
   /* Perform the init sequence.  This sequence of commands is constructed so
    * that it will get the device into nybble mode irrespective of what state
-   * the device is currently in (could be 8 bit, 4 bit nyb 0, 4 bit nyb 1). By
-   * sending the 'set 8-bit mode' three times, we will definitely end up in 8
-   * bit mode, and then we can reliably transition to 4 bit mode for the
-   * remainder of operations.
+   * the device is currently in (could be 8 bit, 4 bit nyb 0, 4 bit nyb 1).
+   * By sending the 'set 8-bit mode' three times, we will definitely end up
+   * in 8 bit mode, and then we can reliably transition to 4 bit mode for
+   * the remainder of operations.
    */
 
   /* Send Command 0x30, set 8-bit mode, and wait > 4.1 ms */
@@ -575,8 +576,8 @@ static void lcd_init(FAR struct pcf8574_lcd_dev_s *priv)
   latch_nybble(priv, 0x30 >> 4, false);
   nxsig_usleep(200);
 
-  /* now Function set: Set interface to be 4 bits long (only 1 cycle write for
-   * the first time).
+  /* now Function set: Set interface to be 4 bits long (only 1 cycle write
+   * for the first time).
    */
 
   latch_nybble(priv, 0x20 >> 4, false);
@@ -603,23 +604,23 @@ static void lcd_init(FAR struct pcf8574_lcd_dev_s *priv)
 
   /* Display On, Cursor Off */
 
-  lcd_putcmd(priv, 0x0C);
+  lcd_putcmd(priv, 0x0c);
 }
 
 /****************************************************************************
  * Name: lcd_create_char
  *
  * Description:
- *  This creates a custom character pattern.  There can be 8 5x8 patterns.
- *  The bitmap proceeds top to bottom, msb-lsb, and is right justified (i.e.
- *  only bits 4-0 are used).  By convention, you are meant to always leave the
- *  last line (byte) zero so that the cursor can use this line, but this is
- *  not strictly required.
+ *   This creates a custom character pattern.  There can be 8 5x8 patterns.
+ *   The bitmap proceeds top to bottom, msb-lsb, and is right justified (i.e.
+ *   only bits 4-0 are used).  By convention, you are meant to always leave
+ *   the last line (byte) zero so that the cursor can use this line, but this
+ *   is not strictly required.
  *
  * Input Parameters:
- *  priv - device instance
- *  idxchar - which character is being imaged; 0 - 7
- *  chardata - the character image bitmap; must be 8 bytes always
+ *   priv     - device instance
+ *   idxchar  - which character is being imaged; 0 - 7
+ *   chardata - the character image bitmap; must be 8 bytes always
  *
  ****************************************************************************/
 
@@ -1020,8 +1021,8 @@ static int lcd_getstream(FAR struct lib_instream_s *instream)
  ****************************************************************************/
 
 static void lcd_fpos_to_curpos(FAR struct pcf8574_lcd_dev_s *priv,
-                               off_t fpos, FAR uint8_t *row, FAR uint8_t *col,
-                               FAR bool *onlf)
+                               off_t fpos, FAR uint8_t *row,
+                               FAR uint8_t *col, FAR bool *onlf)
 {
   int virtcols;
 
@@ -1123,6 +1124,7 @@ static int pcf8574_lcd_close(FAR struct file *filep)
         {
           /* We have no real teardown at present */
         }
+
       ret = OK;
     }
 
@@ -1354,8 +1356,8 @@ static ssize_t pcf8574_lcd_write(FAR struct file *filep,
         {
           lcd_codec_action(priv, (enum slcdcode_e)ch, count);
 
-          /* we can't know what happened, so it's easier just to re-inquire as
-           * to where we are.
+          /* we can't know what happened, so it's easier just to re-inquire
+           * as to where we are.
            */
 
           lcd_get_curpos(priv, &row, &col);
@@ -1441,6 +1443,7 @@ static off_t pcf8574_lcd_seek(FAR struct file *filep, off_t offset,
       break;
 
     default:
+
       /* Return EINVAL if the whence argument is invalid */
 
       pos = (off_t) - EINVAL;
@@ -1624,7 +1627,8 @@ static int pcf8574_lcd_unlink(FAR struct inode *inode)
 
 int pcf8574_lcd_backpack_register(FAR const char *devpath,
                                   FAR struct i2c_master_s *i2c,
-                                  FAR struct pcf8574_lcd_backpack_config_s *cfg)
+                                  FAR struct pcf8574_lcd_backpack_config_s
+                                  *cfg)
 {
   FAR struct pcf8574_lcd_dev_s *priv;
   int ret;
@@ -1637,7 +1641,8 @@ int pcf8574_lcd_backpack_register(FAR const char *devpath,
       return -EINVAL;
     }
 
-  if ((cfg->cols < 1 || cfg->cols > 64) || (cfg->rows == 4 && cfg->cols > 32))
+  if ((cfg->cols < 1 || cfg->cols > 64) ||
+      (cfg->rows == 4 && cfg->cols > 32))
     {
       lcdinfo("Display cols must be 1-64, and may not be part of a 4x40 "
               "configuration\n");