BobbyMi / glcd-arduino

Automatically exported from code.google.com/p/glcd-arduino
0 stars 0 forks source link

Warn for Display sizes that are too large #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The device header needs to do a check to see if the DISPLAY_WIDTH
is larger than what the underlying device code can support.

Currently with 8 bit X values, the maximum supported X value is 254
not 255. So the maximum DISPLAY_WIDTH is 255 not 256.
This is because to provide certain capabilities the code needs to be able
set the X value to be bigger than DISPLAY_WIDTH.
When all you have is 8 bits, then DISPLAY_WIDTH can't be larger than 254 to
allow room for a larger X value.

So.....
The device code will determine the maximum size of the underlying
device code and then if the DISPLAY_WIDTH is greater than that,
issue a warning but then declare DISPLAY_WIDTH to the maximum allowed.

NOTE:
If there is some sort of glcd_coord_t type for the X values then
this check needs to use sizeof(glcd_coord_t) to determine the maximum.
Which for 8 vs 16 bits would be 254 or 65534

Original issue reported on code.google.com by bperry...@gmail.com on 24 Mar 2011 at 6:32

GoogleCodeExporter commented 9 years ago
The header can do this but warnings don't show up in the IDE.
For now the code is there in the ks0108 device header to this but it
will silently make this modification.

The ks0108 device header is currently adjusting down a display width
from 256 down to 255. It does issue a warning for this but with the current IDE
it does not show up.

Original comment by bperry...@gmail.com on 24 Mar 2011 at 6:32