Early debug fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2674 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-05-15 20:28:09 +00:00
parent 393fb7daf5
commit a7bb44354f
3 changed files with 23 additions and 16 deletions
+2 -2
View File
@@ -580,7 +580,7 @@ CONFIG_NX_MXCLIENTMSGS=16
# RiT P14201 OLED Driver Configuration # RiT P14201 OLED Driver Configuration
# #
# CONFIG_LCD_P14201 - Enable P14201 support # CONFIG_LCD_P14201 - Enable P14201 support
# CONFIG_P14201_SPIMODE - Controls the SPI mode # CONFIG_P14201_SPIMODE - Controls the SPI mode (should be mode 2)
# CONFIG_P14201_FREQUENCY - Define to use a different bus frequency # CONFIG_P14201_FREQUENCY - Define to use a different bus frequency
# CONFIG_P14201_NINTERFACES - Specifies the number of physical P14201 devices that # CONFIG_P14201_NINTERFACES - Specifies the number of physical P14201 devices that
# will be supported. # will be supported.
@@ -593,7 +593,7 @@ CONFIG_NX_MXCLIENTMSGS=16
# #
# The latter limitation effectively reduces the 128x96 disply to 64x96. # The latter limitation effectively reduces the 128x96 disply to 64x96.
CONFIG_LCD_P14201=y CONFIG_LCD_P14201=y
CONFIG_P14201_SPIMODE=0 CONFIG_P14201_SPIMODE=2
CONFIG_P14201_FREQUENCY=20000000 CONFIG_P14201_FREQUENCY=20000000
CONFIG_P14201_NINTERFACES=1 CONFIG_P14201_NINTERFACES=1
CONFIG_P14201_FRAMEBUFFER=y CONFIG_P14201_FRAMEBUFFER=y
+5
View File
@@ -45,6 +45,7 @@
#include <errno.h> #include <errno.h>
#include <nuttx/spi.h> #include <nuttx/spi.h>
#include <nuttx/lcd.h>
#include <nuttx/p14201.h> #include <nuttx/p14201.h>
#include "lm3s_internal.h" #include "lm3s_internal.h"
@@ -94,6 +95,10 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
else else
{ {
gllvdbg("Bound SPI port 0 to OLED %d\n", devno); gllvdbg("Bound SPI port 0 to OLED %d\n", devno);
/* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */
(void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
return dev; return dev;
} }
} }
+16 -14
View File
@@ -93,6 +93,8 @@
#ifndef CONFIG_P14201_SPIMODE #ifndef CONFIG_P14201_SPIMODE
# define CONFIG_P14201_SPIMODE SPIDEV_MODE2 # define CONFIG_P14201_SPIMODE SPIDEV_MODE2
#endif #endif
#undef CONFIG_P14201_SPIMODE
# define CONFIG_P14201_SPIMODE SPIDEV_MODE2
/* CONFIG_P14201_NINTERFACES determines the number of physical interfaces /* CONFIG_P14201_NINTERFACES determines the number of physical interfaces
* that will be supported. * that will be supported.
@@ -440,16 +442,21 @@ static const uint8_t g_setallrow[] =
static inline void rit_configspi(FAR struct spi_dev_s *spi) static inline void rit_configspi(FAR struct spi_dev_s *spi)
{ {
#ifdef CONFIG_P14201_FREQUENCY
ritdbg("Mode: %d Bits: 8 Frequency: %d\n",
CONFIG_P14201_SPIMODE, CONFIG_P14201_FREQUENCY);
#else
ritdbg("Mode: %d Bits: 8\n", CONFIG_P14201_SPIMODE);
#endif
/* Configure SPI for the P14201. But only if we own the SPI bus. Otherwise, don't /* Configure SPI for the P14201. But only if we own the SPI bus. Otherwise, don't
* bother because it might change. * bother because it might change.
*/ */
#ifdef CONFIG_SPI_OWNBUS #ifdef CONFIG_SPI_OWNBUS
ritdbg("Mode: %d Bits: 8\n", CONFIG_P14201_SPIMODE);
SPI_SETMODE(spi, CONFIG_P14201_SPIMODE); SPI_SETMODE(spi, CONFIG_P14201_SPIMODE);
SPI_SETBITS(spi, 8); SPI_SETBITS(spi, 8);
#ifdef CONFIG_P14201_FREQUENCY #ifdef CONFIG_P14201_FREQUENCY
ritdbg("Frequency: %d\n", CONFIG_P14201_FREQUENCY);
SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY) SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY)
#endif #endif
#endif #endif
@@ -476,7 +483,6 @@ static inline void rit_select(FAR struct spi_dev_s *spi)
{ {
/* We own the SPI bus, so just select the chip */ /* We own the SPI bus, so just select the chip */
ritdbg("Selected\n");
SPI_SELECT(spi, SPIDEV_DISPLAY, true); SPI_SELECT(spi, SPIDEV_DISPLAY, true);
} }
#else #else
@@ -486,7 +492,6 @@ static void rit_select(FAR struct spi_dev_s *spi)
* devices competing for the SPI bus * devices competing for the SPI bus
*/ */
ritdbg("Selected\n");
SPI_LOCK(spi, true); SPI_LOCK(spi, true);
SPI_SELECT(spi, SPIDEV_DISPLAY, true); SPI_SELECT(spi, SPIDEV_DISPLAY, true);
@@ -494,11 +499,9 @@ static void rit_select(FAR struct spi_dev_s *spi)
* might have gotten configured for a different device while unlocked) * might have gotten configured for a different device while unlocked)
*/ */
ritdbg("Mode: %d Bits: 8\n", CONFIG_P14201_SPIMODE);
SPI_SETMODE(spi, CONFIG_P14201_SPIMODE); SPI_SETMODE(spi, CONFIG_P14201_SPIMODE);
SPI_SETBITS(spi, 8); SPI_SETBITS(spi, 8);
#ifdef CONFIG_P14201_FREQUENCY #ifdef CONFIG_P14201_FREQUENCY
ritdbg("Frequency: %d\n", CONFIG_P14201_FREQUENCY);
SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY); SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY);
#endif #endif
} }
@@ -525,7 +528,6 @@ static inline void rit_deselect(FAR struct spi_dev_s *spi)
{ {
/* We own the SPI bus, so just de-select the chip */ /* We own the SPI bus, so just de-select the chip */
ritdbg("De-selected\n");
SPI_SELECT(spi, SPIDEV_DISPLAY, false); SPI_SELECT(spi, SPIDEV_DISPLAY, false);
} }
#else #else
@@ -533,7 +535,6 @@ static void rit_deselect(FAR struct spi_dev_s *spi)
{ {
/* De-select P14201 chip and relinquish the SPI bus. */ /* De-select P14201 chip and relinquish the SPI bus. */
ritdbg("De-selected\n");
SPI_SELECT(spi, SPIDEV_DISPLAY, false); SPI_SELECT(spi, SPIDEV_DISPLAY, false);
SPI_LOCK(spi, false); SPI_LOCK(spi, false);
} }
@@ -618,7 +619,7 @@ static void rit_sndcmds(FAR struct rit_dev_s *priv, FAR const uint8_t *table)
while ((cmdlen = *table++) != 0) while ((cmdlen = *table++) != 0)
{ {
ritdbg("command: %02x cmdlen: %d\n", cmdlen, *table); ritdbg("command: %02x cmdlen: %d\n", *table, cmdlen);
rit_sndcmd(priv, table, cmdlen); rit_sndcmd(priv, table, cmdlen);
table += cmdlen; table += cmdlen;
} }
@@ -765,6 +766,7 @@ static int rit_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
start = col >> 1; start = col >> 1;
aend = (col + npixels) >> 1; aend = (col + npixels) >> 1;
end = (col + npixels + 1) >> 1; end = (col + npixels + 1) >> 1;
ritdbg("start: %d aend: %d end: %d\n", start, aend, end);
/* Copy the run into the framebuffer, handling nibble alignment */ /* Copy the run into the framebuffer, handling nibble alignment */
@@ -1173,17 +1175,17 @@ FAR struct lcd_dev_s *rit_initialize(FAR struct spi_dev_s *spi, unsigned int dev
gvdbg("Initializing devno: %d\n", devno); gvdbg("Initializing devno: %d\n", devno);
/* Configure and enable LCD */
rit_configspi(spi);
rit_sndcmds(priv, g_initcmds);
/* Driver state data */ /* Driver state data */
priv->spi = spi; priv->spi = spi;
priv->contrast = RIT_CONTRAST; priv->contrast = RIT_CONTRAST;
priv->on = false; priv->on = false;
/* Configure and enable LCD */
rit_configspi(spi);
rit_sndcmds(priv, g_initcmds);
/* Clear the display */ /* Clear the display */
rit_clear(priv); rit_clear(priv);