Advertisement
Toxus

HD44780 backlight initialization disable patch

Feb 22nd, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.73 KB | None | 0 0
  1. ? RGB-patch.diff
  2. Index: hd44780-piplate.c
  3. ===================================================================
  4. RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-piplate.c,v
  5. retrieving revision 1.1
  6. diff -u -5 -p -r1.1 hd44780-piplate.c
  7. --- hd44780-piplate.c   7 Apr 2013 11:50:29 -0000   1.1
  8. +++ hd44780-piplate.c   22 Feb 2014 08:04:37 -0000
  9. @@ -209,22 +209,22 @@ hd_init_i2c_piplate(Driver *drvthis)
  10.     i2c_write_reg(p, MCP23017_IODIRA,
  11.               (unsigned char) (L_KEY_BIT | U_KEY_BIT | D_KEY_BIT | R_KEY_BIT | S_KEY_BIT) & ~(G_BIT | R_BIT));
  12.  
  13.     /* IODIRB - LCD control/data bus signals as outputs */
  14.     i2c_write_reg(p, MCP23017_IODIRB,
  15. -             (unsigned char) ~(RS_BIT | RW_BIT | EN_BIT | D0_BIT | D1_BIT | D2_BIT | D3_BIT | B_BIT));
  16. +             (unsigned char) ~(RS_BIT | RW_BIT | EN_BIT | D0_BIT | D1_BIT | D2_BIT | D3_BIT ));//B_BIT));
  17.  
  18.     /* GPPUA - Pullups for key switch inputs */
  19.     i2c_write_reg(p, MCP23017_GPPUA,
  20.               (unsigned char) (L_KEY_BIT | U_KEY_BIT | D_KEY_BIT | R_KEY_BIT | S_KEY_BIT) & ~(G_BIT | R_BIT));
  21.  
  22.     /* GPPUB - Pullups disabled */
  23.     i2c_write_reg(p, MCP23017_GPPUB, (unsigned char) 0x00);
  24.  
  25.     /* Set driver functions */
  26.     hd44780_functions->senddata = i2c_piplate_HD44780_senddata;
  27. -   hd44780_functions->backlight = i2c_piplate_HD44780_backlight;
  28. +   hd44780_functions->backlight = NULL; //i2c_piplate_HD44780_backlight;
  29.     hd44780_functions->scankeypad = i2c_piplate_HD44780_scankeypad;
  30.     hd44780_functions->close = i2c_piplate_HD44780_close;
  31.  
  32.     /* Initialize the LCD */
  33.     hd44780_functions->senddata(p, 0, RS_INSTR, 0x33);
  34. @@ -278,12 +278,12 @@ i2c_piplate_HD44780_senddata(PrivateData
  35.             write_val &= ~RS_BIT;
  36.         else
  37.             write_val |= RS_BIT;
  38.  
  39.         /* Set the blue backlight bit if backlight is on */
  40. -       if (p->backlightstate == BACKLIGHT_OFF)
  41. -           write_val |= B_BIT;
  42. +       //if (p->backlightstate == BACKLIGHT_OFF)
  43. +       //  write_val |= R_BIT;
  44.  
  45.         /* Set enable bit */
  46.         i2c_write_reg(p, MCP23017_GPIOB, write_val | EN_BIT);
  47.  
  48.         p->hd44780_functions->uPause(p, 1);
  49. @@ -319,22 +319,22 @@ i2c_piplate_HD44780_backlight(PrivateDat
  50.     if (i2c_read_reg(p, MCP23017_GPIOB, &gpiob) != 0) {
  51.         return;
  52.     }
  53.  
  54.     /* Set or clear the RGB bits. Backlight is ON if the bits are CLEAR */
  55. -   if (state == BACKLIGHT_ON) {
  56. -       gpioa &= ~(R_BIT | G_BIT);
  57. -       gpiob &= ~(B_BIT);
  58. -   }
  59. -   else {
  60. -       gpioa |= (R_BIT | G_BIT);
  61. -       gpiob |= (B_BIT);
  62. -   }
  63. +   //if (state == BACKLIGHT_ON) {
  64. +   //  gpioa &= ~(R_BIT | G_BIT);
  65. +   //  gpiob &= ~(B_BIT);
  66. +   //}
  67. +   //else {
  68. +   //  gpioa |= (R_BIT | G_BIT);
  69. +   //  gpiob |= (B_BIT);
  70. +   //}
  71.  
  72.     /* Write the RGB bits */
  73. -   i2c_write_reg(p, MCP23017_GPIOA, gpioa);
  74. -   i2c_write_reg(p, MCP23017_GPIOB, gpiob);
  75. +   //i2c_write_reg(p, MCP23017_GPIOA, gpioa);
  76. +   //i2c_write_reg(p, MCP23017_GPIOB, gpiob);
  77.  }
  78.  
  79.  /**
  80.   * Scan the LCD keys
  81.   * \param p      Pointer to driver's private data structure.
  82. Index: hd44780.c
  83. ===================================================================
  84. RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780.c,v
  85. retrieving revision 1.110
  86. diff -u -5 -p -r1.110 hd44780.c
  87. --- hd44780.c   29 Jan 2014 21:48:04 -0000  1.110
  88. +++ hd44780.c   22 Feb 2014 08:04:38 -0000
  89. @@ -156,11 +156,11 @@ HD44780_init(Driver *drvthis)
  90.     p->cellheight = 8;  /* Do not change this !!! This is a
  91.                  * controller property, not a display
  92.                  * property !!! */
  93.     p->cellwidth = 5;
  94.     p->ccmode = standard;
  95. -   p->backlightstate = -1; /* Init to invalid value */
  96. +   p->backlightstate = 1;  /* Init to invalid value */
  97.     p->fd = -1;
  98.  
  99.  
  100.     /* READ THE CONFIG FILE */
  101.  
  102. @@ -397,14 +397,14 @@ HD44780_init(Driver *drvthis)
  103.     /* consistency check: no local output function => no output */
  104.     if (p->hd44780_functions->output == NULL)
  105.         p->have_output = 0;
  106.  
  107.     /* set contrast */
  108. -   HD44780_set_contrast(drvthis, p->contrast);
  109. +   //HD44780_set_contrast(drvthis, p->contrast);
  110.  
  111.     /* Display startup parameters on the LCD */
  112. -   HD44780_clear(drvthis);
  113. +   //HD44780_clear(drvthis);
  114.     sprintf(buf, "HD44780 %dx%d", p->width, p->height);
  115.     HD44780_string(drvthis, 1, 1, buf);
  116.     switch(if_type) {
  117.       case IF_TYPE_USB:
  118.         sprintf(buf, "USB %s%s%s",
  119. @@ -876,11 +876,11 @@ HD44780_set_brightness(Driver *drvthis,
  120.  
  121.     /*
  122.      * Make last backlight state invalid to force update on next
  123.      * rendering
  124.      */
  125. -   p->backlightstate = -1;
  126. +   //p->backlightstate = -1;
  127.  }
  128.  
  129.  
  130.  /**
  131.   * Turn the LCD backlight on or off.
  132. @@ -895,11 +895,11 @@ HD44780_backlight(Driver *drvthis, int o
  133.     /* Immediately return if no backlight is available or no change is necessary */
  134.     if (!p->have_backlight || p->backlightstate == on)
  135.         return;
  136.  
  137.     if (p->hd44780_functions->backlight != NULL)
  138. -       p->hd44780_functions->backlight(p, on);
  139. +   //  p->hd44780_functions->backlight(p, on);
  140.  
  141.     p->backlightstate = on;
  142.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement