diff --git a/ChangeLog b/ChangeLog
index efc4a629497..25f86c22563 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1701,7 +1701,7 @@
and a failure to get a CGI page. The consequence can be a very serious bug!
* configs/lpcxpresso-lpc1768/usbstorage, thttpd, and dhcpd: Add an USB storage,
THTTPD web server, and DHCP server configurations for the NXP LPCXpresso board.
- * drivers/lcd/ug-9664hswag01.c and ssd1305.h: Add support for Univision UG-9664SWAG01
+ * drivers/lcd/ug-9664hswag01.c and ssd1305.h: Add support for Univision UG-9664HSWAG01
OLED with Solomon Systech SD1305 LCD controller.
* configs/lpcxpresso-lpc1668/nx: Add a NX graphics configuration for the LPCXPRESO
board.
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index e655bb9af9e..5c5e2ff88fc 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -8,7 +8,7 @@
NuttX RTOS
- Last Updated: April 15, 2011
+ Last Updated: April 18, 2011
|
@@ -2232,6 +2232,12 @@ nuttx-6.2 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
'#if CONFIG_NFILE_DESCRIPTOR > 0' was wrong in both of these files. It should
be '#if CONFIG_NFILE_DESCRIPTORS > 0'. This causes a dup2() failure in THTTPD
and a failure to get a CGI page. The consequence can be a very serious bug!
+ * configs/lpcxpresso-lpc1768/usbstorage, thttpd, and dhcpd: Add an USB storage,
+ THTTPD web server, and DHCP server configurations for the NXP LPCXpresso board.
+ * drivers/lcd/ug-9664hswag01.c and ssd1305.h: Add support for Univision UG-9664HSWAG01
+ OLED with Solomon Systech SD1305 LCD controller.
+ * configs/lpcxpresso-lpc1668/nx: Add a NX graphics configuration for the LPCXPRESO
+ board.
apps-6.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/configs/lpcxpresso-lpc1768/README.txt b/configs/lpcxpresso-lpc1768/README.txt
index 1ccd7f623c3..ca5de5ef587 100755
--- a/configs/lpcxpresso-lpc1768/README.txt
+++ b/configs/lpcxpresso-lpc1768/README.txt
@@ -140,7 +140,8 @@ USB Device
PIO0_3-VBUS_SENSE** 39 P0.5
These jumper settings are listed for information only. They are *not*
- required for use with NuttX and LPCXpresso.
+ required for use with NuttX and LPCXpresso. The configurable pins
+ (P0.21 and P0.5) are not used!
*J14 must be set to permit GPIO control of the USB connect pin
**J12 must be set to permit GPIO control of the USB vbus sense pin
@@ -163,7 +164,7 @@ USB Device
P0.5/I2SRX-WS/TD2/CAP2.1 P0[5] | 39 | PIO0_3-VBUS_SENSE VBUS via J12
------------------------------ --------------+------+------------------- ---------------------------
- *P2.9 Connect to a transistor driven USB-D+ pullup on the LPCXpresso board.
+ *P2.9 connects to a transistor driven USB-D+ pullup on the LPCXpresso board.
96x64 White OLED with I2C/SPI interface
---------------------------------------
@@ -719,6 +720,9 @@ Where is one of the following:
(for execution from FLASH.) See apps/examples/README.txt for information
about the dhcpd example.
+ Jumpers: Nothing special. Use the default base board jumper
+ settings.
+
nsh:
Configures the NuttShell (nsh) located at apps/examples/nsh. The
Configuration enables both the serial and telnet NSH interfaces.
@@ -730,9 +734,28 @@ Where is one of the following:
removes the problem. TODO: Tune this frequency to some optimal
value.
+ Jumpers: J55 must be set to provide chip select PIO1_11 signal as
+ the SD slot chip select.
+
+ nx:
+ And example using the NuttX graphics system (NX). This example
+ uses the UG-9664HSWAG01 driver.
+
+ Jumpers: There are several jumper settings needed by the OLED.
+ All are the default settings:
+
+ J42: Close to select the SPI interface (Default: closed)
+ J43: Close to support OLED command/data select (Default: closed)
+ J44: Close to allow control of OLED voltage (Default: closed)
+ J45: Close to select SPI clock (Default: closed)
+ J46: Close SPI data input (MOSI) (Default:closed)
+
ostest:
This configuration directory, performs a simple OS test using
apps/examples/ostest.
+
+ Jumpers: Nothing special. Use the default base board jumper
+ settings.
thttpd:
This builds the THTTPD web server example using the THTTPD and
@@ -741,6 +764,9 @@ Where is one of the following:
NOTE: You will need to build the NXFLAT toolchain as described
above in order to use this example.
+ Jumpers: Nothing special. Use the default base board jumper
+ settings.
+
usbstorage:
This configuration directory exercises the USB mass storage
class driver at apps/examples/usbstorage. See apps/examples/README.txt
@@ -750,3 +776,7 @@ Where is one of the following:
high and the SD will fail. Setting that frequency to 400000
removes the problem. TODO: Tune this frequency to some optimal
value.
+
+ Jumpers: J55 must be set to provide chip select PIO1_11 signal as
+ the SD slot chip select.
+
diff --git a/configs/lpcxpresso-lpc1768/dhcpd/defconfig b/configs/lpcxpresso-lpc1768/dhcpd/defconfig
index cb20930ec21..a638ba538aa 100755
--- a/configs/lpcxpresso-lpc1768/dhcpd/defconfig
+++ b/configs/lpcxpresso-lpc1768/dhcpd/defconfig
@@ -76,7 +76,7 @@ CONFIG_ARCH_CHIP=lpc17xx
CONFIG_ARCH_CHIP_LPC1768=y
CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
CONFIG_ARCH_BOARD_LPCXPRESSO=y
-CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_BOARD_LOOPSPERMSEC=8079
CONFIG_DRAM_SIZE=(32*1024)
CONFIG_DRAM_START=0x10000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
diff --git a/configs/lpcxpresso-lpc1768/nsh/defconfig b/configs/lpcxpresso-lpc1768/nsh/defconfig
index 76ca6d88b5c..6a2dfb006e7 100755
--- a/configs/lpcxpresso-lpc1768/nsh/defconfig
+++ b/configs/lpcxpresso-lpc1768/nsh/defconfig
@@ -76,7 +76,7 @@ CONFIG_ARCH_CHIP=lpc17xx
CONFIG_ARCH_CHIP_LPC1768=y
CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
CONFIG_ARCH_BOARD_LPCXPRESSO=y
-CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_BOARD_LOOPSPERMSEC=8079
CONFIG_DRAM_SIZE=(32*1024)
CONFIG_DRAM_START=0x10000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
diff --git a/configs/lpcxpresso-lpc1768/nx/defconfig b/configs/lpcxpresso-lpc1768/nx/defconfig
index db720580488..f06875b35ec 100755
--- a/configs/lpcxpresso-lpc1768/nx/defconfig
+++ b/configs/lpcxpresso-lpc1768/nx/defconfig
@@ -76,7 +76,7 @@ CONFIG_ARCH_CHIP=lpc17xx
CONFIG_ARCH_CHIP_LPC1768=y
CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
CONFIG_ARCH_BOARD_LPCXPRESSO=y
-CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_BOARD_LOOPSPERMSEC=8079
CONFIG_DRAM_SIZE=(32*1024)
CONFIG_DRAM_START=0x10000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
diff --git a/configs/lpcxpresso-lpc1768/ostest/defconfig b/configs/lpcxpresso-lpc1768/ostest/defconfig
index 85315674327..718766c45f8 100755
--- a/configs/lpcxpresso-lpc1768/ostest/defconfig
+++ b/configs/lpcxpresso-lpc1768/ostest/defconfig
@@ -76,7 +76,7 @@ CONFIG_ARCH_CHIP=lpc17xx
CONFIG_ARCH_CHIP_LPC1768=y
CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
CONFIG_ARCH_BOARD_LPCXPRESSO=y
-CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_BOARD_LOOPSPERMSEC=8079
CONFIG_DRAM_SIZE=(32*1024)
CONFIG_DRAM_START=0x10000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
diff --git a/configs/lpcxpresso-lpc1768/src/up_oled.c b/configs/lpcxpresso-lpc1768/src/up_oled.c
index 84d099153f8..f3d884bb396 100755
--- a/configs/lpcxpresso-lpc1768/src/up_oled.c
+++ b/configs/lpcxpresso-lpc1768/src/up_oled.c
@@ -151,7 +151,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
return NULL;
}
-/******************************************************************************
+/****************************************************************************
* Name: lpc17_ssp1cmddata
*
* Description:
@@ -172,7 +172,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
* Returned Value:
* None
*
- ******************************************************************************/
+ ****************************************************************************/
int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
{
@@ -203,12 +203,12 @@ int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
* Returned Value:
* None
*
- **************************************************************************************/
+ ****************************************************************************/
#ifdef CONFIG_UG9664HSWAG01_POWER
void ug_power(unsigned int devno, bool on)
{
- gllvdbg("on: \n", on ? "TRUE" : "FALSE");
+ gllvdbg("power %s\n", on ? "ON" : "OFF");
(void)lpc17_gpiowrite(LPCXPRESSO_OLED_POWER, on);
}
#endif
diff --git a/configs/lpcxpresso-lpc1768/thttpd/defconfig b/configs/lpcxpresso-lpc1768/thttpd/defconfig
index dc7dba9376e..8816c7fdcec 100755
--- a/configs/lpcxpresso-lpc1768/thttpd/defconfig
+++ b/configs/lpcxpresso-lpc1768/thttpd/defconfig
@@ -76,7 +76,7 @@ CONFIG_ARCH_CHIP=lpc17xx
CONFIG_ARCH_CHIP_LPC1768=y
CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
CONFIG_ARCH_BOARD_LPCXPRESSO=y
-CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_BOARD_LOOPSPERMSEC=8079
CONFIG_DRAM_SIZE=(32*1024)
CONFIG_DRAM_START=0x10000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
diff --git a/configs/lpcxpresso-lpc1768/usbstorage/defconfig b/configs/lpcxpresso-lpc1768/usbstorage/defconfig
index e8f9d62867a..04ce1472cc5 100755
--- a/configs/lpcxpresso-lpc1768/usbstorage/defconfig
+++ b/configs/lpcxpresso-lpc1768/usbstorage/defconfig
@@ -76,7 +76,7 @@ CONFIG_ARCH_CHIP=lpc17xx
CONFIG_ARCH_CHIP_LPC1768=y
CONFIG_ARCH_BOARD=lpcxpresso-lpc1768
CONFIG_ARCH_BOARD_LPCXPRESSO=y
-CONFIG_BOARD_LOOPSPERMSEC=7982
+CONFIG_BOARD_LOOPSPERMSEC=8079
CONFIG_DRAM_SIZE=(32*1024)
CONFIG_DRAM_START=0x10000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
diff --git a/drivers/lcd/ug-9664hswag01.c b/drivers/lcd/ug-9664hswag01.c
index e3949d46272..0aecbabcf87 100755
--- a/drivers/lcd/ug-9664hswag01.c
+++ b/drivers/lcd/ug-9664hswag01.c
@@ -189,7 +189,7 @@
/* The size of the shadow frame buffer */
-#define UG_FBSIZE (UG_XRES * (UG_XRES >> 3))
+#define UG_FBSIZE (UG_STRIDE * UG_YRES)
/* Debug ******************************************************************************/
@@ -215,14 +215,14 @@ struct ug_dev_s
FAR struct spi_dev_s *spi;
uint8_t contrast;
- bool powered;
+ uint8_t powered;
/* The SSD1305 does not support reading from the display memory in SPI mode.
- * Since there is 1 BPP and access is byte-by-byte, it is necessary to kee
+ * Since there is 1 BPP and access is byte-by-byte, it is necessary to keep
* a shadow copy of the framebuffer memory.
*/
- uint8_t fb[UG_XRES >> 3][UG_YRES];
+ uint8_t fb[UG_FBSIZE];
};
/**************************************************************************************
@@ -291,7 +291,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv);
* if there are multiple LCD devices, they must each have unique run buffers.
*/
-static uint8_t g_runbuffer[UG_XRES >> 8];
+static uint8_t g_runbuffer[UG_STRIDE];
/* This structure describes the overall LCD video controller */
@@ -340,6 +340,35 @@ static struct ug_dev_s g_ugdev =
* Private Functions
**************************************************************************************/
+/**************************************************************************************
+ * Name: ug_powerstring
+ *
+ * Description:
+ * Convert the power setting to a string.
+ *
+ **************************************************************************************/
+
+
+static inline FAR const char *ug_powerstring(uint8_t power)
+{
+ if (power == UG_POWER_OFF)
+ {
+ return "OFF";
+ }
+ else if (power == UG_POWER_DIM)
+ {
+ return "DIM";
+ }
+ else if (power == UG_POWER_ON)
+ {
+ return "ON";
+ }
+ else
+ {
+ return "ERROR";
+ }
+}
+
/**************************************************************************************
* Function: ug_select
*
@@ -460,14 +489,14 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
/* Verify that some portion of the run remains on the display */
- if (pixlen <= 0 || row > UG_YRES)
+ if (pixlen <= 0 || row > UG_YRES)
{
return OK;
}
/* Update the shadow frame buffer memory */
- fbptr = &priv->fb[0][row];
+ fbptr = &priv->fb[row * UG_STRIDE];
pixelno = 0;
endcol = col + pixlen;
@@ -475,7 +504,7 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
{
/* Point to the byte to be modified */
- FAR uint8_t *ptr = &fbptr[i >> 8];
+ FAR uint8_t *ptr = &fbptr[i >> 3];
/* Set or clear the corresponding bit */
@@ -555,7 +584,7 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
**************************************************************************************/
static int ug_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
- size_t npixels)
+ size_t npixels)
{
/* Because of this line of code, we will only be able to support a single UG device */
@@ -577,13 +606,16 @@ static int ug_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
pixlen = (int)UG_XRES - (int)col;
}
- /* Fetch the data from the shadow frame buffer memory */
+ /* Verify that some portion of the run is actually the display */
- fbptr = &priv->fb[0][row];
+ if (pixlen <= 0 || row > UG_YRES)
+ {
+ return -EINVAL;
+ }
- /* Then transfer all of the data */
+ /* Then transfer the display data from the shadow frame buffer memory */
- fbptr = &priv->fb[0][row];
+ fbptr = &priv->fb[row * UG_STRIDE];
pixelno = 0;
endcol = col + pixlen;
*buffer = 0;
@@ -662,8 +694,8 @@ static int ug_getpower(struct lcd_dev_s *dev)
{
struct ug_dev_s *priv = (struct ug_dev_s *)dev;
DEBUGASSERT(priv);
- gvdbg("powered: %s\n", priv->powered ? "TRUE" : "FALSE");
- return priv->powered ? 1 : 0;
+ gvdbg("powered: %s\n", ug_powerstring(priv->powered));
+ return priv->powered;
}
/**************************************************************************************
@@ -679,16 +711,14 @@ static int ug_setpower(struct lcd_dev_s *dev, int power)
{
struct ug_dev_s *priv = (struct ug_dev_s *)dev;
- gvdbg("power: %s powered: %s\n",
- power != 0 ? "TRUE" : "FALSE",
- priv->powered != 0 ? "TRUE" : "FALSE");
-
DEBUGASSERT(priv && (unsigned)power <= CONFIG_LCD_MAXPOWER);
+ gvdbg("power: %s powered: %s\n",
+ ug_powerstring(power), ug_powerstring(priv->powered));
/* Select and lock the device */
ug_select(priv->spi);
- if (power <= 0)
+ if (power <= UG_POWER_OFF)
{
/* Turn the display off */
@@ -697,26 +727,27 @@ static int ug_setpower(struct lcd_dev_s *dev, int power)
/* Remove power to the device */
ug_power(0, false);
- priv->powered = false;
+ priv->powered = UG_POWER_OFF;
}
else
{
/* Turn the display on, dim or normal */
- if (power == 1)
+ if (power == UG_POWER_DIM)
{
(void)SPI_SEND(priv->spi, SSD1305_DISPONDIM); /* Display on, dim mode */
}
- else /* if (power > 1) */
+ else /* if (power > UG_POWER_DIM) */
{
(void)SPI_SEND(priv->spi, SSD1305_DISPON); /* Display on, normal mode */
+ power = UG_POWER_ON;
}
(void)SPI_SEND(priv->spi, SSD1305_DISPRAM); /* Resume to RAM content display */
/* Restore power to the device */
ug_power(0, true);
- priv->powered = true;
+ priv->powered = power;
}
ug_deselect(priv->spi);
@@ -823,7 +854,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
for (j = 0; j < 8; j++, row++)
{
- (void)SPI_SNDBLOCK(priv->spi, &priv->fb[0][row], UG_XRES >> 3);
+ (void)SPI_SNDBLOCK(priv->spi, &priv->fb[row * UG_STRIDE], UG_STRIDE);
}
}
@@ -837,12 +868,23 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
**************************************************************************************/
/**************************************************************************************
- * Name: up_oledinitialize
+ * Name: ug_initialize
*
* Description:
- * Initialize the LCD video hardware. The initial state of the LCD is fully
- * initialized, display memory cleared, and the LCD ready to use, but with the power
- * setting at 0 (full off).
+ * Initialize the UG-9664HSWAG01 video hardware. The initial state of the
+ * OLED is fully initialized, display memory cleared, and the OLED ready to
+ * use, but with the power setting at 0 (full off == sleep mode).
+ *
+ * Input Parameters:
+ *
+ * spi - A reference to the SPI driver instance.
+ * devno - A value in the range of 0 through CONFIG_UG9664HSWAG01_NINTERFACES-1.
+ * This allows support for multiple OLED devices.
+ *
+ * Returned Value:
+ *
+ * On success, this function returns a reference to the LCD object for the specified
+ * OLED. NULL is returned on any failure.
*
**************************************************************************************/
diff --git a/include/nuttx/lcd/ug-9664hswag01.h b/include/nuttx/lcd/ug-9664hswag01.h
index 0ef2955e132..61d53c369bb 100755
--- a/include/nuttx/lcd/ug-9664hswag01.h
+++ b/include/nuttx/lcd/ug-9664hswag01.h
@@ -105,21 +105,21 @@ extern "C" {
*
* Description:
* Initialize the UG-9664HSWAG01 video hardware. The initial state of the
- * OLED is fully initialized, display memory cleared, and the OLED ready to
- * use, but with the power setting at 0 (full off == sleep mode).
+ * OLED is fully initialized, display memory cleared, and the OLED ready
+ * to use, but with the power setting at 0 (full off == sleep mode).
*
* Input Parameters:
*
* spi - A reference to the SPI driver instance.
- * devno - A value in the range of 0 throuh CONFIG_UG9664HSWAG01_NINTERFACES-1.
+ * devno - A value in the range of 0 through CONFIG_UG9664HSWAG01_NINTERFACES-1.
* This allows support for multiple OLED devices.
*
* Returned Value:
*
- * On success, this function returns a reference to the LCD object for the specified
- * OLED. NULL is returned on any failure.
+ * On success, this function returns a reference to the LCD object for
+ * the specified OLED. NULL is returned on any failure.
*
- **************************************************************************************/
+ ****************************************************************************/
struct lcd_dev_s; /* see nuttx/lcd.h */
struct spi_dev_s; /* see nuttx/spi.h */