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:
parent
393fb7daf5
commit
a7bb44354f
@ -580,7 +580,7 @@ CONFIG_NX_MXCLIENTMSGS=16
|
||||
# RiT P14201 OLED Driver Configuration
|
||||
#
|
||||
# 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_NINTERFACES - Specifies the number of physical P14201 devices that
|
||||
# will be supported.
|
||||
@ -593,7 +593,7 @@ CONFIG_NX_MXCLIENTMSGS=16
|
||||
#
|
||||
# The latter limitation effectively reduces the 128x96 disply to 64x96.
|
||||
CONFIG_LCD_P14201=y
|
||||
CONFIG_P14201_SPIMODE=0
|
||||
CONFIG_P14201_SPIMODE=2
|
||||
CONFIG_P14201_FREQUENCY=20000000
|
||||
CONFIG_P14201_NINTERFACES=1
|
||||
CONFIG_P14201_FRAMEBUFFER=y
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
#include <nuttx/lcd.h>
|
||||
#include <nuttx/p14201.h>
|
||||
|
||||
#include "lm3s_internal.h"
|
||||
@ -94,6 +95,10 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,8 @@
|
||||
#ifndef CONFIG_P14201_SPIMODE
|
||||
# define CONFIG_P14201_SPIMODE SPIDEV_MODE2
|
||||
#endif
|
||||
#undef CONFIG_P14201_SPIMODE
|
||||
# define CONFIG_P14201_SPIMODE SPIDEV_MODE2
|
||||
|
||||
/* CONFIG_P14201_NINTERFACES determines the number of physical interfaces
|
||||
* 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)
|
||||
{
|
||||
#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
|
||||
* bother because it might change.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SPI_OWNBUS
|
||||
ritdbg("Mode: %d Bits: 8\n", CONFIG_P14201_SPIMODE);
|
||||
SPI_SETMODE(spi, CONFIG_P14201_SPIMODE);
|
||||
SPI_SETBITS(spi, 8);
|
||||
#ifdef CONFIG_P14201_FREQUENCY
|
||||
ritdbg("Frequency: %d\n", CONFIG_P14201_FREQUENCY);
|
||||
SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY)
|
||||
#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 */
|
||||
|
||||
ritdbg("Selected\n");
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
||||
}
|
||||
#else
|
||||
@ -486,7 +492,6 @@ static void rit_select(FAR struct spi_dev_s *spi)
|
||||
* devices competing for the SPI bus
|
||||
*/
|
||||
|
||||
ritdbg("Selected\n");
|
||||
SPI_LOCK(spi, 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)
|
||||
*/
|
||||
|
||||
ritdbg("Mode: %d Bits: 8\n", CONFIG_P14201_SPIMODE);
|
||||
SPI_SETMODE(spi, CONFIG_P14201_SPIMODE);
|
||||
SPI_SETBITS(spi, 8);
|
||||
#ifdef CONFIG_P14201_FREQUENCY
|
||||
ritdbg("Frequency: %d\n", CONFIG_P14201_FREQUENCY);
|
||||
SPI_SETFREQUENCY(spi, CONFIG_P14201_FREQUENCY);
|
||||
#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 */
|
||||
|
||||
ritdbg("De-selected\n");
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
||||
}
|
||||
#else
|
||||
@ -533,7 +535,6 @@ static void rit_deselect(FAR struct spi_dev_s *spi)
|
||||
{
|
||||
/* De-select P14201 chip and relinquish the SPI bus. */
|
||||
|
||||
ritdbg("De-selected\n");
|
||||
SPI_SELECT(spi, SPIDEV_DISPLAY, 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)
|
||||
{
|
||||
ritdbg("command: %02x cmdlen: %d\n", cmdlen, *table);
|
||||
ritdbg("command: %02x cmdlen: %d\n", *table, cmdlen);
|
||||
rit_sndcmd(priv, 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;
|
||||
aend = (col + npixels) >> 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 */
|
||||
|
||||
@ -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);
|
||||
|
||||
/* Configure and enable LCD */
|
||||
|
||||
rit_configspi(spi);
|
||||
rit_sndcmds(priv, g_initcmds);
|
||||
|
||||
/* Driver state data */
|
||||
|
||||
priv->spi = spi;
|
||||
priv->contrast = RIT_CONTRAST;
|
||||
priv->on = false;
|
||||
|
||||
/* Configure and enable LCD */
|
||||
|
||||
rit_configspi(spi);
|
||||
rit_sndcmds(priv, g_initcmds);
|
||||
|
||||
/* Clear the display */
|
||||
|
||||
rit_clear(priv);
|
||||
|
Loading…
Reference in New Issue
Block a user