summaryrefslogtreecommitdiff
path: root/nuttx/configs/stm32ldiscovery
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-05-25 13:46:43 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-05-25 13:46:43 -0600
commitf7102cb478678502cd7b6a3ff60e27025f52281e (patch)
treeb719c9d1b8ca62563bc67f7d3503fa3cc89599bc /nuttx/configs/stm32ldiscovery
parent3e175c2bca6cad7210541535b21c33f8698adcde (diff)
downloadnuttx-f7102cb478678502cd7b6a3ff60e27025f52281e.tar.gz
nuttx-f7102cb478678502cd7b6a3ff60e27025f52281e.tar.bz2
nuttx-f7102cb478678502cd7b6a3ff60e27025f52281e.zip
PCB-Logic PIC32MX LCD1602 driver now supports SLCD CODED; Added an SLCD ioctl command to get cursor position
Diffstat (limited to 'nuttx/configs/stm32ldiscovery')
-rw-r--r--nuttx/configs/stm32ldiscovery/README.txt2
-rw-r--r--nuttx/configs/stm32ldiscovery/src/stm32_lcd.c37
2 files changed, 34 insertions, 5 deletions
diff --git a/nuttx/configs/stm32ldiscovery/README.txt b/nuttx/configs/stm32ldiscovery/README.txt
index e1f7b35fe..88234b761 100644
--- a/nuttx/configs/stm32ldiscovery/README.txt
+++ b/nuttx/configs/stm32ldiscovery/README.txt
@@ -788,7 +788,7 @@ Configuration sub-directories
4. To enable SLCD support:
Board Selection:
- CONFIG_ARCH_LEDS=y : Disable LED support
+ CONFIG_ARCH_LEDS=n : Disable LED support
Library Routines:
CONFIG_LIB_SLCDCODEC=y : Enable the SLCD CODEC
diff --git a/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c b/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c
index ace9dbc9c..abc9a0644 100644
--- a/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c
+++ b/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c
@@ -59,6 +59,7 @@
#include <nuttx/ascii.h>
#include <nuttx/streams.h>
#include <nuttx/fs/fs.h>
+#include <nuttx/lcd/slcd_ioctl.h>
#include <nuttx/lcd/slcd_codec.h>
#include "up_arch.h"
@@ -313,8 +314,8 @@ static void slcd_writebar(void);
static inline uint16_t slcd_mapch(uint8_t ch);
static inline void slcd_writemem(uint16_t segset, int curpos);
static void slcd_writech(uint8_t ch, uint8_t curpos, uint8_t options);
-static inline void slcd_appendch(uint8_t ch, uint8_t options);
-static inline void slcd_action(enum slcdcode_e code, uint8_t count);
+static void slcd_appendch(uint8_t ch, uint8_t options);
+static void slcd_action(enum slcdcode_e code, uint8_t count);
/* Character driver methods */
@@ -999,7 +1000,7 @@ static void slcd_action(enum slcdcode_e code, uint8_t count)
case SLCDCODE_RIGHT: /* Cursor right by N characters */
{
- /* Don't permit movement past the lcd of the SLCD */
+ /* Don't permit movement past the end of the SLCD */
if (g_slcdstate.curpos < (SLCD_NCHARS - 1))
{
@@ -1040,6 +1041,11 @@ static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len)
int ret = 0;
int i;
+ /* Try to read the entire display. Notice that the seek offset
+ * (filp->f_pos) is ignored. It probably should be taken into account
+ * and also updated after each read and write.
+ */
+
for (i = 0; i < SLCD_NCHARS && ret < len; i++)
{
/* Return the character */
@@ -1233,6 +1239,29 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
}
break;
+ /* SLCDIOC_CURPOS: Get the SLCD cursor positioni (rows x characters)
+ *
+ * argument: Pointer to struct slcd_curpos_s in which values will be
+ * returned
+ */
+
+
+ case SLCDIOC_CURPOS:
+ {
+ FAR struct slcd_curpos_s *curpos = (FAR struct slcd_curpos_s *)((uintptr_t)arg);
+
+ lcdvdbg("SLCDIOC_CURPOS: row=0 column=%d\n", g_slcdstate.curpos);
+
+ if (!curpos)
+ {
+ return -EINVAL;
+ }
+
+ curpos->row = 0;
+ curpos->column = g_slcdstate.curpos;
+ }
+ break;
+
/* SLCDIOC_SETBAR: Set bars on a bar display
*
* argument: 32-bit bitset, with each bit corresponding to one bar.
@@ -1477,7 +1506,7 @@ int stm32_slcd_initialize(void)
/* Register the LCD device driver */
- ret = register_driver("/dev/slcd", &g_slcdops, 0644, (FAR struct file_operations *)&g_slcdops);
+ ret = register_driver("/dev/slcd", &g_slcdops, 0644, &g_slcdstate);
g_slcdstate.initialized = true;
/* Then clear the display */