diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-30 18:46:40 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-30 18:46:40 +0000 |
commit | 238189eb7e383097103d5d97261f4d2c1bf79b3f (patch) | |
tree | 48330e9a45c78c1add0c6f08fe5fca608b6fb474 /nuttx/drivers/lcd | |
parent | eff4606e227da40f6aaaa1dfa008ed126a55f9b5 (diff) | |
download | px4-nuttx-238189eb7e383097103d5d97261f4d2c1bf79b3f.tar.gz px4-nuttx-238189eb7e383097103d5d97261f4d2c1bf79b3f.tar.bz2 px4-nuttx-238189eb7e383097103d5d97261f4d2c1bf79b3f.zip |
Fix some of the SSD1289 initial register settings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4788 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/lcd')
-rw-r--r-- | nuttx/drivers/lcd/ssd1289.c | 28 | ||||
-rw-r--r-- | nuttx/drivers/lcd/ssd1289.h | 6 |
2 files changed, 21 insertions, 13 deletions
diff --git a/nuttx/drivers/lcd/ssd1289.c b/nuttx/drivers/lcd/ssd1289.c index 5833ff145..6e547228a 100644 --- a/nuttx/drivers/lcd/ssd1289.c +++ b/nuttx/drivers/lcd/ssd1289.c @@ -224,7 +224,7 @@ static int ssd1289_setcontrast(FAR struct lcd_dev_s *dev, unsigned int contrast) /* 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 @@ -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; #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_ENTRY_ID_HINCVINC | SSD1289_ENTRY_TY_B | + (SSD1289_ENTRY_ID_HINCVINC | SSD1289_ENTRY_TY_C | SSD1289_ENTRY_DMODE_RAM | SSD1289_ENTRY_DFM_65K)); #else /* 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_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)); #endif @@ -1101,11 +1101,13 @@ static inline void ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv) #if 0 up_mdelay(50); #endif + return OK; } #ifndef CONFIG_LCD_NOGETRUN else { lcddbg("Unsupported LCD type\n"); + return -ENODEV; } #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) { + int ret; + lcdvdbg("Initializing\n"); /* If we ccould support multiple SSD1289 devices, this is where we would allocate @@ -1151,16 +1155,20 @@ FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *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); + /* Turn the display off */ - /* Turn the display off */ + ssd1289_poweroff(lcd); + return &g_lcddev.dev; + } - ssd1289_poweroff(lcd); - return &g_lcddev.dev; + return NULL; } /************************************************************************************** diff --git a/nuttx/drivers/lcd/ssd1289.h b/nuttx/drivers/lcd/ssd1289.h index 77606776e..5eed844b0 100644 --- a/nuttx/drivers/lcd/ssd1289.h +++ b/nuttx/drivers/lcd/ssd1289.h @@ -120,8 +120,8 @@ /* Driver output control */ #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(n) ((n) < 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_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_BGR (1 << 11) /* Order from RGB to BGR in 18-bit GDDRAM data */ @@ -285,7 +285,7 @@ /* 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(n) ((n) << SSD1289_PWRCTRL4_VDV_SHIFT) #define SSD1289_PWRCTRL4_VCOMG (1 << 13) /* VcomL variable */ |