xuio / u8glib

Mirror for code.google.com/p/u8glib
Other
0 stars 0 forks source link

Contrast assignment wrong for DOGXL240 #340

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. It seems to be a bug.

Please locate this file/code in your folder structure:
https://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_uc1611_dogxl240.c
Setting of the contrast is done in lines 102

The wrong code is this:

   case U8G_DEV_MSG_CONTRAST:
     u8g_SetChipSelect(u8g, dev, 0);
     u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
     u8g_WriteByte(u8g, dev, 0x81);
     u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);  /* set contrast from, keep gain at 0 */
     u8g_SetChipSelect(u8g, dev, 1);
     return 1;

Correct code sould be:

   case U8G_DEV_MSG_CONTRAST:
     u8g_SetChipSelect(u8g, dev, 1);
     u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
     u8g_WriteByte(u8g, dev, 0x81);
     u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);  /* set contrast from, keep gain at 0 */
     u8g_SetChipSelect(u8g, dev, 0);
     return 1;

see http://forum.arduino.cc/index.php?topic=322256.new#new

Original issue reported on code.google.com by olikr...@gmail.com on 12 May 2015 at 12:51

GoogleCodeExporter commented 9 years ago
actually it should be:
   case U8G_DEV_MSG_CONTRAST:
     u8g_SetChipSelect(u8g, dev, 1);
     u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
     u8g_WriteByte(u8g, dev, 0x81);
     u8g_WriteByte(u8g, dev, (*(uint8_t *)arg));  /* set contrast from, keep gain at 0 */
     u8g_SetChipSelect(u8g, dev, 0);
     return 1;

Original comment by olikr...@gmail.com on 12 May 2015 at 5:36