Samsung yp-s3: clean up the lcd and button driver (making things static, rename variables etc.)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22203 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2009-08-08 09:24:42 +00:00
parent 236a0582c3
commit c8e39403f4
2 changed files with 16 additions and 14 deletions

View file

@ -24,6 +24,7 @@
#include "inttypes.h" #include "inttypes.h"
#include "s5l8700.h" #include "s5l8700.h"
#include "button.h"
#include "button-target.h" #include "button-target.h"
/* Button driver for the touch keys on the Samsung YP-S3 /* Button driver for the touch keys on the Samsung YP-S3
@ -63,7 +64,8 @@ void button_init_device(void)
PCON4 &= ~0x0000F000; PCON4 &= ~0x0000F000;
} }
static unsigned int tkey_read(void) /* returns the raw 20-bit word from the touch key controller */
static int tkey_read(void)
{ {
static int value = 0; static int value = 0;
int i; int i;
@ -103,7 +105,7 @@ static unsigned int tkey_read(void)
int button_read_device(void) int button_read_device(void)
{ {
int buttons = 0; int buttons = 0;
static unsigned int data; int tkey_data;
/* hold switch */ /* hold switch */
if (button_hold()) { if (button_hold()) {
@ -116,26 +118,26 @@ int button_read_device(void)
} }
/* touch keys */ /* touch keys */
data = tkey_read(); tkey_data = tkey_read();
if (data & (1 << 9)) { if (tkey_data & (1 << 9)) {
buttons |= BUTTON_BACK; buttons |= BUTTON_BACK;
} }
if (data & (1 << 8)) { if (tkey_data & (1 << 8)) {
buttons |= BUTTON_UP; buttons |= BUTTON_UP;
} }
if (data & (1 << 7)) { if (tkey_data & (1 << 7)) {
buttons |= BUTTON_MENU; buttons |= BUTTON_MENU;
} }
if (data & (1 << 6)) { if (tkey_data & (1 << 6)) {
buttons |= BUTTON_LEFT; buttons |= BUTTON_LEFT;
} }
if (data & (1 << 5)) { if (tkey_data & (1 << 5)) {
buttons |= BUTTON_SELECT; buttons |= BUTTON_SELECT;
} }
if (data & (1 << 4)) { if (tkey_data & (1 << 4)) {
buttons |= BUTTON_RIGHT; buttons |= BUTTON_RIGHT;
} }
if (data & (1 << 3)) { if (tkey_data & (1 << 3)) {
buttons |= BUTTON_DOWN; buttons |= BUTTON_DOWN;
} }

View file

@ -85,7 +85,7 @@ static void lcd_wcmd_data(unsigned int cmd, unsigned int data)
lcd_wdata(data); lcd_wdata(data);
} }
void lcd_init1(void) static void lcd_init1(void)
{ {
lcd_wcmd(0x11); lcd_wcmd(0x11);
lcd_delay(10000); lcd_delay(10000);
@ -157,7 +157,7 @@ void lcd_init1(void)
lcd_wcmd(0x2C); lcd_wcmd(0x2C);
} }
void lcd_init2(void) static void lcd_init2(void)
{ {
lcd_wcmd_data(0x00, 0x0001); lcd_wcmd_data(0x00, 0x0001);
lcd_delay(50000); lcd_delay(50000);
@ -234,7 +234,7 @@ void lcd_init2(void)
} }
void lcd_set_window1(int x, int y, int width, int height) static void lcd_set_window1(int x, int y, int width, int height)
{ {
(void)x; (void)x;
(void)width; (void)width;
@ -250,7 +250,7 @@ void lcd_set_window1(int x, int y, int width, int height)
lcd_wdata(0); lcd_wdata(0);
} }
void lcd_set_window2(int x, int y, int width, int height) static void lcd_set_window2(int x, int y, int width, int height)
{ {
lcd_wcmd_data(0x50, x); lcd_wcmd_data(0x50, x);
lcd_wcmd_data(0x51, x + width - 1); lcd_wcmd_data(0x51, x + width - 1);