Minor OLED-related updates (still doesn't work)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3522 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-04-18 20:13:54 +00:00
parent f9424121a7
commit cb4211cae4
12 changed files with 127 additions and 49 deletions
+1 -1
View File
@@ -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.
+7 -1
View File
@@ -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: April 15, 2011</p>
<p>Last Updated: April 18, 2011</p>
</td>
</tr>
</table>
@@ -2232,6 +2232,12 @@ nuttx-6.2 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
'#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 &lt;spudmonkey@racsa.co.cr&gt;
+32 -2
View File
@@ -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 <subdir> 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 <subdir> 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 <subdir> 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 <subdir> 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.
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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)
@@ -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)
+71 -29
View File
@@ -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.
*
**************************************************************************************/
+6 -6
View File
@@ -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 */