diff options
-rw-r--r-- | apps/examples/slcd/slcd_main.c | 20 | ||||
-rw-r--r-- | nuttx/ChangeLog | 3 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 8 | ||||
-rw-r--r-- | nuttx/configs/stm32ldiscovery/README.txt | 6 | ||||
-rw-r--r-- | nuttx/configs/stm32ldiscovery/src/stm32_lcd.c | 54 | ||||
-rw-r--r-- | nuttx/include/nuttx/lcd/slcd_codec.h | 1 |
6 files changed, 58 insertions, 34 deletions
diff --git a/apps/examples/slcd/slcd_main.c b/apps/examples/slcd/slcd_main.c index 1d93993fb..a5fb12d9f 100644 --- a/apps/examples/slcd/slcd_main.c +++ b/apps/examples/slcd/slcd_main.c @@ -243,8 +243,20 @@ static void slcd_puts(FAR struct lib_outstream_s *outstream, int slcd_main(int argc, char *argv[]) { FAR struct slcd_test_s *priv = &g_slcdtest; + FAR const char *str = g_slcdhello; int ret; + /* Parse the command line. For now, only a single optional string argument + * is supported. + */ + +#if defined(CONFIG_NSH_BUILTIN_APPS) + if (argc > 1) + { + str = argv[1]; + } +#endif + /* Initialize the output stream */ memset(priv, 0, sizeof(struct slcd_test_s)); @@ -273,8 +285,8 @@ int slcd_main(int argc, char *argv[]) goto errout_with_fd; } - printf("Geometry rows: %d columns: %d\n", - priv->geo.nrows, priv->geo.ncolumns); + printf("Geometry rows: %d columns: %d nbars: %d\n", + priv->geo.nrows, priv->geo.ncolumns, priv->geo.nbars); /* Home the cursor and clear the display */ @@ -283,8 +295,8 @@ int slcd_main(int argc, char *argv[]) /* Say hello */ - printf("Print [%s]\n", g_slcdhello); - slcd_puts(&priv->stream, g_slcdhello); + printf("Print [%s]\n", str); + slcd_puts(&priv->stream, str); slcd_flush(&priv->stream); /* Normal exit */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 9936b1ed8..d6cdac186 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4790,4 +4790,7 @@ USB device, the board does not (2013-5-24). * arch/arm/src/stm32/stm32_lse.c: Add support for the STM32L CSR register and for the LSE LCD clock source (2013-5-24). + * The STM32L-Discovery segment LCD is now functional and the README file + includes instructions for adding the apps/examples/slcd segment LCD + test as an NSH "built-in" command (2013-5-24). diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index c2157a945..523d5b6da 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: May 22, 2013</p> + <p>Last Updated: May 24, 2013</p> </td> </tr> </table> @@ -2245,9 +2245,9 @@ nsh> <p> <b>STATUS</b>. Initial support for the STM32L-Discovery was released in NuttX-6.28. - This initial support is very minimal: - There is a configuration using the NuttShell (<a href="NuttShell.html">NSH</a>) that might be the basis for an application development. - As of this writing, a few more things are needed to make this a more complete port: 1) Verfication of more device drivers, and 2) logic that actually uses the low-power consumption modes of the EnergyLite part. + This initial support includes a configuration using the NuttShell (<a href="NuttShell.html">NSH</a>) that might be the basis for an application development. + A driver for the on-board segment LCD is included as well as an option to drive the segment LCD from an NSH "built-in" command. + As of this writing, a few more things are needed to make this a more complete port: 1) Verfication of more device drivers (timers, quadrature encoders, PWM, etc.), and 2) logic that actually uses the low-power consumption modes of the EnergyLite part. </p> <p> <b>Memory Usage</b>. diff --git a/nuttx/configs/stm32ldiscovery/README.txt b/nuttx/configs/stm32ldiscovery/README.txt index 73a5c54f6..02298c433 100644 --- a/nuttx/configs/stm32ldiscovery/README.txt +++ b/nuttx/configs/stm32ldiscovery/README.txt @@ -789,3 +789,9 @@ Configurations Build Setup: CONFIG_DEBUG=y : Enable debug features CONFIG_DEBUG_VERBOSE=y : Enable LCD debug + + NOTE: At this point in time, testing of the SLCD is very limited because + there is not much in apps/examples/slcd. Certainly there are more bugs + to be found. There are also many segment-encoded glyphs in stm32_lcd.c + But there is a basically functional driver with a working test setup + that can be extended if you want a fully functional SLCD driver. diff --git a/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c b/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c index 57e09d9cb..ace9dbc9c 100644 --- a/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c +++ b/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c @@ -127,19 +127,20 @@ /* An ASCII character may need to be decorated with a colon or decimal point */ -#define SCLD_DP 0x01 -#define SCLD_COLON 0x02 +#define SLCD_DP 0x01 +#define SLCD_COLON 0x02 +#define SLCD_NBARS 4 /* Macros used for set/reset the LCD bar */ -#define SCLD_BAR0_ON g_slcdstate.bar[1] |= 8 -#define SCLD_BAR0_OFF g_slcdstate.bar[1] &= ~8 -#define SCLD_BAR1_ON g_slcdstate.bar[0] |= 8 -#define SCLD_BAR1_OFF g_slcdstate.bar[0] &= ~8 -#define SCLD_BAR2_ON g_slcdstate.bar[1] |= 2 -#define SCLD_BAR2_OFF g_slcdstate.bar[1] &= ~2 -#define SCLD_BAR3_ON g_slcdstate.bar[0] |= 2 -#define SCLD_BAR3_OFF g_slcdstate.bar[0] &= ~2 +#define SLCD_BAR0_ON g_slcdstate.bar[1] |= 8 +#define SLCD_BAR0_OFF g_slcdstate.bar[1] &= ~8 +#define SLCD_BAR1_ON g_slcdstate.bar[0] |= 8 +#define SLCD_BAR1_OFF g_slcdstate.bar[0] &= ~8 +#define SLCD_BAR2_ON g_slcdstate.bar[1] |= 2 +#define SLCD_BAR2_OFF g_slcdstate.bar[1] &= ~2 +#define SLCD_BAR3_ON g_slcdstate.bar[0] |= 2 +#define SLCD_BAR3_OFF g_slcdstate.bar[0] &= ~2 /* These definitions support the logic of slcd_writemem() * @@ -177,9 +178,9 @@ /* SLCD_CHAR1_MASK COM0-3 0xcffffffc ..11 .... .... .... .... .... .... ..11 */ #define SLCD_CHAR1_MASK0 0xcffffffc -#define SLCD_CHAR1_MASK1 SLCD_CHAR3_MASK0 -#define SLCD_CHAR1_MASK2 SLCD_CHAR3_MASK0 -#define SLCD_CHAR1_MASK3 SLCD_CHAR3_MASK0 +#define SLCD_CHAR1_MASK1 SLCD_CHAR1_MASK0 +#define SLCD_CHAR1_MASK2 SLCD_CHAR1_MASK0 +#define SLCD_CHAR1_MASK3 SLCD_CHAR1_MASK0 #define SLCD_CHAR1_UPDATE0(s) (((uint32_t)(s) & 0x0c) << 26) | \ ((uint32_t)(s) & 0x03) #define SLCD_CHAR1_UPDATE1(s) SLCD_CHAR1_UPDATE0(s) @@ -464,7 +465,7 @@ static void slcd_dumpslcd(FAR const char *msg) lcdvdbg(" CR: %08x FCR: %08x SR: %08x CLR: %08x:\n", getreg32(STM32_LCD_CR), getreg32(STM32_LCD_FCR), getreg32(STM32_LCD_SR), getreg32(STM32_LCD_CLR)); - lcdvdbg(" RAM0L: %08x RAM0L: %08x RAM0L: %08x RAM0L: %08x\n", + lcdvdbg(" RAM0L: %08x RAM1L: %08x RAM2L: %08x RAM3L: %08x\n", getreg32(STM32_LCD_RAM0L), getreg32(STM32_LCD_RAM1L), getreg32(STM32_LCD_RAM2L), getreg32(STM32_LCD_RAM3L)); } @@ -648,7 +649,7 @@ static inline uint16_t slcd_mapch(uint8_t ch) else if (ch < ASCII_LBRACKET) { - return g_slcdnummap[(int)ch - ASCII_A]; + return g_slcdalphamap[(int)ch - ASCII_A]; } /* Handle the next block of puncutation */ @@ -662,7 +663,7 @@ static inline uint16_t slcd_mapch(uint8_t ch) else if (ch < ASCII_LBRACE) { - return g_slcdnummap[(int)ch - ASCII_a]; + return g_slcdalphamap[(int)ch - ASCII_a]; } /* Handle the final block of puncutation */ @@ -837,11 +838,11 @@ static void slcd_writech(uint8_t ch, uint8_t curpos, uint8_t options) /* Check if the character should be decorated with a decimal point or colon */ - if ((options & SCLD_DP) != 0) + if ((options & SLCD_DP) != 0) { segset |= 0x0002; } - else if ((options & SCLD_COLON) != 0) + else if ((options & SLCD_COLON) != 0) { segset |= 0x0020; } @@ -1050,12 +1051,12 @@ static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len) if (ret < len && g_slcdstate.buffer[i] != 0) { - if ((g_slcdstate.buffer[i] & SCLD_DP) != 0) + if ((g_slcdstate.buffer[i] & SLCD_DP) != 0) { *buffer++ = '.'; ret++; } - else if ((g_slcdstate.buffer[i] & SCLD_COLON) != 0) + else if ((g_slcdstate.buffer[i] & SLCD_COLON) != 0) { *buffer++ = ':'; ret++; @@ -1145,7 +1146,7 @@ static ssize_t slcd_write(FAR struct file *filp, { /* Write the previous character with the decimal point appended */ - slcd_appendch(prev, SCLD_DP); + slcd_appendch(prev, SLCD_DP); prev = ' '; valid = false; } @@ -1153,7 +1154,7 @@ static ssize_t slcd_write(FAR struct file *filp, { /* Write the previous character with the colon appended */ - slcd_appendch(prev, SCLD_COLON); + slcd_appendch(prev, SLCD_COLON); prev = ' '; valid = false; } @@ -1228,6 +1229,7 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) geo->nrows = SLCD_NROWS; geo->ncolumns = SLCD_NCHARS; + geo->nbars = SLCD_NBARS; } break; @@ -1247,22 +1249,22 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) if ((arg & 1) != 0) { - SCLD_BAR0_ON; + SLCD_BAR0_ON; } if ((arg & 2) != 0) { - SCLD_BAR1_ON; + SLCD_BAR1_ON; } if ((arg & 4) != 0) { - SCLD_BAR2_ON; + SLCD_BAR2_ON; } if ((arg & 8) != 0) { - SCLD_BAR3_ON; + SLCD_BAR3_ON; } /* Write the bar to SLCD memory */ diff --git a/nuttx/include/nuttx/lcd/slcd_codec.h b/nuttx/include/nuttx/lcd/slcd_codec.h index a6c2ee353..a1037eb1f 100644 --- a/nuttx/include/nuttx/lcd/slcd_codec.h +++ b/nuttx/include/nuttx/lcd/slcd_codec.h @@ -148,6 +148,7 @@ struct slcd_geometry_s { uint16_t nrows; /* Number of the rows on the SLCD */ uint16_t ncolumns; /* Number of characters in one row on the SLCD */ + uint8_t nbars; /* Number of bars supported by the SLCD */ }; /* Working data needed by slcd_encode that must be provided and initialized |