Fix some of the SSD1289 initial register settings

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4788 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-05-30 18:46:40 +00:00
parent eb4f77ce2b
commit b976163a64
3 changed files with 22 additions and 13 deletions

View File

@ -2849,4 +2849,5 @@
* arch/arm/src/stm32_i2c.c: Fix STM32 F2 I2C. It is apparently bug-for-bug * arch/arm/src/stm32_i2c.c: Fix STM32 F2 I2C. It is apparently bug-for-bug
compatible with the F4 and needs the same work-around for the missing BTF compatible with the F4 and needs the same work-around for the missing BTF
signal that was needed for the F4. signal that was needed for the F4.
* drivers/lcd/ssd1289.*: Fix some of the initial register settings.

View File

@ -224,7 +224,7 @@ static int ssd1289_setcontrast(FAR struct lcd_dev_s *dev, unsigned int contrast)
/* Initialization */ /* Initialization */
static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv); static inline int ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv);
/************************************************************************************** /**************************************************************************************
* Private Data * Private Data
@ -823,7 +823,7 @@ static int ssd1289_setcontrast(FAR struct lcd_dev_s *dev, unsigned int contrast)
* *
**************************************************************************************/ **************************************************************************************/
static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv) static inline int ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv)
{ {
FAR struct ssd1289_lcd_s *lcd = priv->lcd; FAR struct ssd1289_lcd_s *lcd = priv->lcd;
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
@ -997,7 +997,7 @@ static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv)
*/ */
ssd1289_putreg(lcd, SSD1289_ENTRY, ssd1289_putreg(lcd, SSD1289_ENTRY,
(SSD1289_ENTRY_ID_HINCVINC | SSD1289_ENTRY_TY_B | (SSD1289_ENTRY_ID_HINCVINC | SSD1289_ENTRY_TY_C |
SSD1289_ENTRY_DMODE_RAM | SSD1289_ENTRY_DFM_65K)); SSD1289_ENTRY_DMODE_RAM | SSD1289_ENTRY_DFM_65K));
#else #else
/* LG=0, AM=1, ID=3, TY=2, DMODE=0, WMODE=0, OEDEF=0, TRANS=0, DRM=3 */ /* LG=0, AM=1, ID=3, TY=2, DMODE=0, WMODE=0, OEDEF=0, TRANS=0, DRM=3 */
@ -1005,7 +1005,7 @@ static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv)
ssd1289_putreg(lcd, SSD1289_ENTRY, ssd1289_putreg(lcd, SSD1289_ENTRY,
(SSD1289_ENTRY_AM | SSD1289_ENTRY_ID_HINCVINC | (SSD1289_ENTRY_AM | SSD1289_ENTRY_ID_HINCVINC |
SSD1289_ENTRY_TY_B | SSD1289_ENTRY_DMODE_RAM | SSD1289_ENTRY_TY_C | SSD1289_ENTRY_DMODE_RAM |
SSD1289_ENTRY_DFM_65K)); SSD1289_ENTRY_DFM_65K));
#endif #endif
@ -1101,11 +1101,13 @@ static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv)
#if 0 #if 0
up_mdelay(50); up_mdelay(50);
#endif #endif
return OK;
} }
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
else else
{ {
lcddbg("Unsupported LCD type\n"); lcddbg("Unsupported LCD type\n");
return -ENODEV;
} }
#endif #endif
@ -1130,6 +1132,8 @@ static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv)
FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *lcd) FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *lcd)
{ {
int ret;
lcdvdbg("Initializing\n"); lcdvdbg("Initializing\n");
/* If we ccould support multiple SSD1289 devices, this is where we would allocate /* If we ccould support multiple SSD1289 devices, this is where we would allocate
@ -1151,8 +1155,9 @@ FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *lcd)
/* Configure and enable LCD */ /* Configure and enable LCD */
ssd1289_hwinitialize(priv); ret = ssd1289_hwinitialize(priv);
if (ret == OK)
{
/* Clear the display (setting it to the color 0=black) */ /* Clear the display (setting it to the color 0=black) */
ssd1289_clear(&priv->dev, 0); ssd1289_clear(&priv->dev, 0);
@ -1161,6 +1166,9 @@ FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *lcd)
ssd1289_poweroff(lcd); ssd1289_poweroff(lcd);
return &g_lcddev.dev; return &g_lcddev.dev;
}
return NULL;
} }
/************************************************************************************** /**************************************************************************************

View File

@ -120,8 +120,8 @@
/* Driver output control */ /* Driver output control */
#define SSD1289_OUTCTRL_MUX_SHIFT (0) /* Number of lines for the LCD driver */ #define SSD1289_OUTCTRL_MUX_SHIFT (0) /* Number of lines for the LCD driver */
#define SSD1289_OUTCTRL_MUX_MASK (0x1ff < SSD1289_OUTCTRL_MUX_SHIFT) #define SSD1289_OUTCTRL_MUX_MASK (0x1ff << SSD1289_OUTCTRL_MUX_SHIFT)
# define SSD1289_OUTCTRL_MUX(n) ((n) < SSD1289_OUTCTRL_MUX_SHIFT) # define SSD1289_OUTCTRL_MUX(n) ((n) << SSD1289_OUTCTRL_MUX_SHIFT)
#define SSD1289_OUTCTRL_TB (1 << 9) /* Selects the output shift direction of the gate driver */ #define SSD1289_OUTCTRL_TB (1 << 9) /* Selects the output shift direction of the gate driver */
#define SSD1289_OUTCTRL_SM (1 << 10) /* Scanning order of gate driver */ #define SSD1289_OUTCTRL_SM (1 << 10) /* Scanning order of gate driver */
#define SSD1289_OUTCTRL_BGR (1 << 11) /* Order from RGB to BGR in 18-bit GDDRAM data */ #define SSD1289_OUTCTRL_BGR (1 << 11) /* Order from RGB to BGR in 18-bit GDDRAM data */
@ -285,7 +285,7 @@
/* Power control 4 */ /* Power control 4 */
#define SSD1289_PWRCTRL4_VDV_SHIFT (9) /* Set amplitude magnification of VLCD63 */ #define SSD1289_PWRCTRL4_VDV_SHIFT (8) /* Set amplitude magnification of VLCD63 */
#define SSD1289_PWRCTRL4_VDV_MASK (32 << SSD1289_PWRCTRL4_VDV_SHIFT) #define SSD1289_PWRCTRL4_VDV_MASK (32 << SSD1289_PWRCTRL4_VDV_SHIFT)
# define SSD1289_PWRCTRL4_VDV(n) ((n) << SSD1289_PWRCTRL4_VDV_SHIFT) # define SSD1289_PWRCTRL4_VDV(n) ((n) << SSD1289_PWRCTRL4_VDV_SHIFT)
#define SSD1289_PWRCTRL4_VCOMG (1 << 13) /* VcomL variable */ #define SSD1289_PWRCTRL4_VCOMG (1 << 13) /* VcomL variable */