Zunixyz / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

confusing: the setContrast function of the st7565_dogm128 driver needs 4* the contrast value in comparison to the init structure #217

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When I call the u8g.setContrast() function with the same value as used in the 
u8g_dev_st7565_dogm128_init_seq init structure (eg. 0x18) the result is a 
display you can hardly read. 

I first played around with some values around 0x18 and could not see any 
difference. Then I found the value-bit-shift part in the driver:

case U8G_DEV_MSG_CONTRAST:
      u8g_SetChipSelect(u8g, dev, 1);
      u8g_SetAddress(u8g, dev, 0);          /* instruction mode */
      u8g_WriteByte(u8g, dev, 0x081);

/**** here ****/
      u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);

And now with contrast values *4 everything works as expected.
Is this a bug or a feature? In the latter case I would recommend a line of 
comment in the user reference 
http://code.google.com/p/u8glib/wiki/userreference#setContrast

Best regards
 Michael

Original issue reported on code.google.com by mmueller...@googlemail.com on 7 Nov 2013 at 4:15

GoogleCodeExporter commented 8 years ago
The range for setContrast is always from 0 to 255 (max). However some 
controllers only have 6 bits or less. So the value is scaled down.

Original comment by olikr...@gmail.com on 7 Nov 2013 at 8:18

GoogleCodeExporter commented 8 years ago

Original comment by olikr...@gmail.com on 22 Jan 2014 at 8:14