The SLCD driver is now fully functional for Sure PIC32MX board
This commit is contained in:
parent
819e151ef5
commit
2dae842445
@ -564,3 +564,5 @@
|
||||
segment LCDs (2013-5-24).
|
||||
* apps/examples/slcd: Extend SLCD test to handle multi-line displays
|
||||
(2013-5-26).
|
||||
* apps/examples/slcd: This test now sets the SLCD brightness level to
|
||||
the mid-point as part of its initialization (2013-5-27).
|
||||
|
@ -279,6 +279,8 @@ int slcd_main(int argc, char *argv[])
|
||||
|
||||
if (!priv->initialized)
|
||||
{
|
||||
unsigned long brightness;
|
||||
|
||||
/* Initialize the output stream */
|
||||
|
||||
memset(priv, 0, sizeof(struct slcd_test_s));
|
||||
@ -296,8 +298,11 @@ int slcd_main(int argc, char *argv[])
|
||||
goto errout_with_fd;
|
||||
}
|
||||
|
||||
printf("Geometry rows: %d columns: %d nbars: %d\n",
|
||||
printf("Attributes:\n");
|
||||
printf(" rows: %d columns: %d nbars: %d\n",
|
||||
priv->attr.nrows, priv->attr.ncolumns, priv->attr.nbars);
|
||||
printf(" max contrast: %d max brightness: %d\n",
|
||||
priv->attr.maxcontrast, priv->attr.maxbrightness);
|
||||
|
||||
/* Home the cursor and clear the display */
|
||||
|
||||
@ -305,6 +310,21 @@ int slcd_main(int argc, char *argv[])
|
||||
slcd_encode(SLCDCODE_CLEAR, 0, &priv->stream);
|
||||
slcd_flush(&priv->stream);
|
||||
|
||||
/* Set the brightness to the mid value */
|
||||
|
||||
brightness = ((unsigned long)priv->attr.maxbrightness + 1) >> 1;
|
||||
printf("Set brightness to %ld\n", brightness);
|
||||
|
||||
ret = ioctl(fd, SLCDIOC_SETBRIGHTNESS, brightness);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* Report the ioctl failure, but do not error out. Some SLCDs
|
||||
* do not support brightness settings.
|
||||
*/
|
||||
|
||||
printf("ioctl(SLCDIOC_GETATTRIBUTES) failed: %d\n", errno);
|
||||
}
|
||||
|
||||
priv->initialized = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user