forked from len0rd/rockbox
Clip+ LCD: support devices with a different controller
The new controller framebuffer (different from what is in clipv1/clipv2 and some clip+) has 128 columns, the old has 132 columns and is centered on the screen. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27257 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
12b89c11e3
commit
9a471e603e
7 changed files with 25 additions and 19 deletions
|
@ -68,6 +68,7 @@
|
|||
/** globals **/
|
||||
|
||||
static bool display_on; /* used by lcd_enable */
|
||||
static int offset; /* column offset */
|
||||
|
||||
/*** hardware configuration ***/
|
||||
|
||||
|
@ -135,10 +136,8 @@ bool lcd_active(void)
|
|||
void lcd_init_device(void)
|
||||
{
|
||||
int i;
|
||||
#define LCD_FULLSCREEN (128+4)
|
||||
fb_data p_bytes[LCD_FULLSCREEN]; /* framebuffer used to clear the screen */
|
||||
|
||||
lcd_hw_init();
|
||||
lcd_hw_init(&offset);
|
||||
|
||||
/* Set display clock (divide ratio = 1) and oscillator frequency (1) */
|
||||
lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ);
|
||||
|
@ -181,12 +180,12 @@ void lcd_init_device(void)
|
|||
lcd_write_command (LCD_SET_HIGHER_COLUMN_ADDRESS /*| 0*/);
|
||||
lcd_write_command (LCD_SET_LOWER_COLUMN_ADDRESS /*| 0*/);
|
||||
|
||||
fb_data p_bytes[LCD_WIDTH + 2 * offset];
|
||||
memset(p_bytes, 0, sizeof(p_bytes)); /* fills with 0 : pixel off */
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
lcd_write_command (LCD_SET_PAGE_ADDRESS | (i /*& 0xf*/));
|
||||
lcd_write_data(p_bytes, LCD_FULLSCREEN /* overscan */);
|
||||
lcd_write_data(p_bytes, LCD_WIDTH + 2 * offset);
|
||||
}
|
||||
|
||||
lcd_enable(true);
|
||||
|
@ -208,8 +207,8 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
|
|||
while (bheight--)
|
||||
{
|
||||
lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2)>>4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset)>>4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf));
|
||||
|
||||
lcd_write_data(data, width);
|
||||
data += stride;
|
||||
|
@ -234,8 +233,8 @@ void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
|
|||
while (bheight--)
|
||||
{
|
||||
lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2)>>4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset)>>4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf));
|
||||
|
||||
lcd_grey_data(values, phases, width);
|
||||
|
||||
|
@ -261,8 +260,8 @@ void lcd_update(void)
|
|||
for (y = 0; y < LCD_FBHEIGHT; y++)
|
||||
{
|
||||
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | ((2 >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | (2 & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | ((offset >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | (offset & 0xf));
|
||||
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
}
|
||||
|
@ -292,8 +291,8 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
for (; y <= ymax; y++)
|
||||
{
|
||||
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2) >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+2) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset) >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf));
|
||||
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
||||
void lcd_hw_init(void)
|
||||
void lcd_hw_init(int *offset)
|
||||
{
|
||||
/* DBOP initialisation, do what OF does */
|
||||
CGU_DBOP = (1<<3) | AS3525_DBOP_DIV;
|
||||
|
@ -45,6 +45,8 @@ void lcd_hw_init(void)
|
|||
GPIOA_PIN(0) = (1<<0);
|
||||
GPIOA_PIN(4) = 0;
|
||||
GPIOB_PIN(6) = (1<<6);
|
||||
|
||||
*offset = 2;
|
||||
}
|
||||
|
||||
#define LCD_DELAY 1
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "config.h"
|
||||
#include "ascodec.h"
|
||||
|
||||
void lcd_hw_init(void) INIT_ATTR;
|
||||
void lcd_hw_init(int *offset) INIT_ATTR;
|
||||
static inline void lcd_enable_power(bool onoff)
|
||||
{
|
||||
ascodec_write(AS3514_DCDC15, onoff ? 1 : 0);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
||||
void lcd_hw_init(void)
|
||||
void lcd_hw_init(int *offset)
|
||||
{
|
||||
bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE);
|
||||
|
||||
|
@ -37,8 +37,11 @@ void lcd_hw_init(void)
|
|||
|
||||
GPIOA_DIR |= (1<<5);
|
||||
GPIOB_DIR |= (1<<2) | (1<<7);
|
||||
GPIOB_DIR &= ~(1<<3);
|
||||
GPIOB_PIN(7) = 0;
|
||||
GPIOA_PIN(5) = (1<<5);
|
||||
|
||||
*offset = GPIOB_PIN(3) ? 0 : 2;
|
||||
}
|
||||
|
||||
void lcd_write_command(int byte)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
void lcd_hw_init(void) INIT_ATTR;
|
||||
void lcd_hw_init(int *offset) INIT_ATTR;
|
||||
static inline void lcd_enable_power(bool onoff)
|
||||
{
|
||||
(void) onoff;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
void lcd_hw_init(void) INIT_ATTR;
|
||||
void lcd_hw_init(int *offset) INIT_ATTR;
|
||||
static inline void lcd_enable_power(bool onoff)
|
||||
{
|
||||
(void) onoff;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
|
||||
void lcd_hw_init(void)
|
||||
void lcd_hw_init(int *offset)
|
||||
{
|
||||
/* DBOP initialisation, do what OF does */
|
||||
CCU_IO |= (1<<12); /* ?? */
|
||||
|
@ -38,6 +38,8 @@ void lcd_hw_init(void)
|
|||
|
||||
GPIOB_DIR |= (1<<2)|(1<<5);
|
||||
GPIOB_PIN(5) = (1<<5);
|
||||
|
||||
*offset = 2;
|
||||
}
|
||||
|
||||
#define LCD_DELAY 10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue