summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx')
-rwxr-xr-xnuttx/configs/lm3s6965-ek/nx/defconfig4
-rwxr-xr-xnuttx/configs/lm3s6965-ek/src/up_oled.c5
-rwxr-xr-xnuttx/drivers/lcd/p14201.c30
3 files changed, 23 insertions, 16 deletions
diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig
index 681bc85d6..601c8c186 100755
--- a/nuttx/configs/lm3s6965-ek/nx/defconfig
+++ b/nuttx/configs/lm3s6965-ek/nx/defconfig
@@ -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
diff --git a/nuttx/configs/lm3s6965-ek/src/up_oled.c b/nuttx/configs/lm3s6965-ek/src/up_oled.c
index 10d467a58..5bc3e9146 100755
--- a/nuttx/configs/lm3s6965-ek/src/up_oled.c
+++ b/nuttx/configs/lm3s6965-ek/src/up_oled.c
@@ -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;
}
}
diff --git a/nuttx/drivers/lcd/p14201.c b/nuttx/drivers/lcd/p14201.c
index 7e334dcdb..b8edc52fe 100755
--- a/nuttx/drivers/lcd/p14201.c
+++ b/nuttx/drivers/lcd/p14201.c
@@ -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);