summaryrefslogtreecommitdiff
path: root/apps/examples/slcd/slcd_main.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-05-27 11:39:13 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-05-27 11:39:13 -0600
commit87d335b92ab7580fdd0aef729646c8c2131b3ec8 (patch)
tree7b8355985532c77efddb0f085d5e0c580ad599bc /apps/examples/slcd/slcd_main.c
parentbec3b36f727b4bccdf9900097ae8d76fb7faa1ab (diff)
downloadnuttx-87d335b92ab7580fdd0aef729646c8c2131b3ec8.tar.gz
nuttx-87d335b92ab7580fdd0aef729646c8c2131b3ec8.tar.bz2
nuttx-87d335b92ab7580fdd0aef729646c8c2131b3ec8.zip
The SLCD driver is now fully functional for Sure PIC32MX board
Diffstat (limited to 'apps/examples/slcd/slcd_main.c')
-rw-r--r--apps/examples/slcd/slcd_main.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/examples/slcd/slcd_main.c b/apps/examples/slcd/slcd_main.c
index e7f0ff00f..ecdd4a2b2 100644
--- a/apps/examples/slcd/slcd_main.c
+++ b/apps/examples/slcd/slcd_main.c
@@ -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;
}