Misc OLED-related bug fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2681 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6541fa26bf
commit
83f135da9f
@ -44,6 +44,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
@ -103,12 +105,15 @@
|
||||
/* GPIOs for OLED:
|
||||
* - PC7: OLED display data/control select (D/Cn)
|
||||
* - PA3: OLED display chip select (CSn)
|
||||
* - PC6: Enable +15V needed by OLED (EN+15V)
|
||||
*/
|
||||
|
||||
#define OLEDDC_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
|
||||
GPIO_VALUE_ONE | GPIO_PORTC | 7)
|
||||
#define OLEDCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
|
||||
GPIO_VALUE_ONE | GPIO_PORTA | 3)
|
||||
#define OLEDEN_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
|
||||
GPIO_VALUE_ONE | GPIO_PORTC | 6)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "lm3s6965ek_internal.h"
|
||||
|
||||
/************************************************************************************
|
||||
@ -74,7 +75,7 @@ void lm3s_boardinitialize(void)
|
||||
* lm3s_ssiinitialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
/* The LM3S6965 Eval Kit microSD CS and OLED are on SSI0 */
|
||||
/* The LM3S6965 Eval Kit microSD CS and OLED are on SSI0 (Duh! There is no SSI1) */
|
||||
|
||||
#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
|
||||
if (lm3s_ssiinitialize)
|
||||
|
@ -55,28 +55,57 @@
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Define the CONFIG_LCD_RITDEBUG to enable detailed debug output (stuff you
|
||||
* would never want to see unless you are debugging this file).
|
||||
*
|
||||
* Verbose debug must also be enabled
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# undef CONFIG_DEBUG_GRAPHICS
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DEBUG_VERBOSE
|
||||
# undef CONFIG_LCD_RITDEBUG
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LCD_RITDEBUG
|
||||
# define ritdbg(format, arg...) vdbg(format, ##arg)
|
||||
# define oleddc_dumpgpio(m) lm3s_dumpgpio(OLEDDC_GPIO, m)
|
||||
# define oledcs_dumpgpio(m) lm3s_dumpgpio(OLEDCS_GPIO, m)
|
||||
#else
|
||||
# define ritdbg(x...)
|
||||
# define oleddc_dumpgpio(m)
|
||||
# define oledcs_dumpgpio(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: up_nxdrvinit
|
||||
*
|
||||
* Description:
|
||||
* Called NX initialization logic to configure the OLED.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct lcd_dev_s *dev;
|
||||
|
||||
/* Configure the OLED D/Cn GPIO */
|
||||
/* Configure the OLED GPIOs */
|
||||
|
||||
lm3s_configgpio(OLEDDC_GPIO);
|
||||
oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup");
|
||||
oleddc_dumpgpio("up_nxdrvinit: On entry");
|
||||
lm3s_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */
|
||||
lm3s_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */
|
||||
oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup");
|
||||
|
||||
/* Get the SPI port */
|
||||
/* Get the SSI port (configure as a Freescale SPI port) */
|
||||
|
||||
spi = up_spiinitialize(0);
|
||||
if (!spi)
|
||||
@ -85,16 +114,16 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bind the SPI port to the OLED */
|
||||
/* Bind the SSI port to the OLED */
|
||||
|
||||
dev = rit_initialize(spi, devno);
|
||||
if (!dev)
|
||||
{
|
||||
glldbg("Failed to bind SPI port 0 to OLED %d: %d\n", devno);
|
||||
glldbg("Failed to bind SSI port 0 to OLED %d: %d\n", devno);
|
||||
}
|
||||
else
|
||||
{
|
||||
gllvdbg("Bound SPI port 0 to OLED %d\n", devno);
|
||||
gllvdbg("Bound SSI port 0 to OLED %d\n", devno);
|
||||
|
||||
/* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */
|
||||
|
||||
@ -105,23 +134,23 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
/******************************************************************************
|
||||
* Name: rit_seldata
|
||||
*
|
||||
* Description:
|
||||
* Set or clear the SD1329 D/Cn bit to select data (true) or command (false). This
|
||||
* function must be provided by platform-specific logic.
|
||||
* Set or clear the SD1329 D/Cn bit to select data (true) or command
|
||||
* (false). This function must be provided by platform-specific logic.
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* devno - A value in the range of 0 throuh CONFIG_P14201_NINTERFACES-1. This allows
|
||||
* support for multiple OLED devices.
|
||||
* devno - A value in the range of 0 throuh CONFIG_P14201_NINTERFACES-1.
|
||||
* This allows support for multiple OLED devices.
|
||||
* data - true: select data; false: select command
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
**************************************************************************************/
|
||||
******************************************************************************/
|
||||
|
||||
void rit_seldata(unsigned int devno, bool data)
|
||||
{
|
||||
|
@ -173,9 +173,9 @@
|
||||
/* Debug ******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LCD_RITDEBUG
|
||||
# define ritdbg(format, arg...) vdbg(format, ##arg)
|
||||
# define ritdbg(format, arg...) vdbg(format, ##arg)
|
||||
#else
|
||||
# define ritdbg(x...)
|
||||
# define ritdbg(x...)
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
@ -1068,7 +1068,7 @@ static int rit_getpower(FAR struct lcd_dev_s *dev)
|
||||
DEBUGASSERT(priv);
|
||||
|
||||
gvdbg("power: %s\n", priv->on ? "ON" : "OFF");
|
||||
return (int)priv->on;
|
||||
return priv->on ? CONFIG_LCD_MAXPOWER : 0;
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
@ -1102,12 +1102,14 @@ static int rit_setpower(struct lcd_dev_s *dev, int power)
|
||||
/* Take the display out of sleep mode */
|
||||
|
||||
rit_sndcmd(priv, g_sleepoff, sizeof(g_sleepoff));
|
||||
priv->on = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Put the display into sleep mode */
|
||||
|
||||
rit_sndcmd(priv, g_sleepon, sizeof(g_sleepon));
|
||||
priv->on = false;
|
||||
}
|
||||
|
||||
/* De-select the SD1329 controller */
|
||||
|
@ -417,7 +417,6 @@ static inline int nxeg_raise(NXEGWINDOW hwnd)
|
||||
static inline int nxeg_suinitialize(void)
|
||||
{
|
||||
FAR NX_DRIVERTYPE *dev;
|
||||
int ret;
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
|
||||
/* Use external graphics driver initialization */
|
||||
@ -432,6 +431,8 @@ static inline int nxeg_suinitialize(void)
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||
int ret;
|
||||
|
||||
/* Initialize the LCD device */
|
||||
|
||||
message("nxeg_initialize: Initializing LCD\n");
|
||||
@ -457,6 +458,8 @@ static inline int nxeg_suinitialize(void)
|
||||
|
||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||
#else
|
||||
int ret;
|
||||
|
||||
/* Initialize the frame buffer device */
|
||||
|
||||
message("nxeg_initialize: Initializing framebuffer\n");
|
||||
|
Loading…
Reference in New Issue
Block a user