summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-04-13 19:06:21 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-04-13 19:06:21 +0000
commit482fefd928c6e77946b6ca3718b371a8cc7a8e73 (patch)
treeb934b4ab59e2644c7039fd561bbc86c64e015a66
parentf830fa79e57db3a743d2e2500c26312a6323f732 (diff)
downloadrockbox-482fefd928c6e77946b6ca3718b371a8cc7a8e73.tar.gz
rockbox-482fefd928c6e77946b6ca3718b371a8cc7a8e73.zip
Fuzev2: simplify button_read_device()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25636 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c29
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c3
2 files changed, 12 insertions, 20 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index 4848d9e7d9..3ae4975b22 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -32,9 +32,11 @@ static bool hold_button = false;
32void button_init_device(void) 32void button_init_device(void)
33{ /* activate the wheel */ 33{ /* activate the wheel */
34 volatile int i; 34 volatile int i;
35 GPIOB_DIR |= 1<<4; 35 GPIOA_DIR &= ~(1<<6|1<<7);
36 GPIOC_DIR = 0;
37 GPIOB_DIR |= (1<<4)|(1<<3)|(1<<0);
36 for(i = 20; i; i--) nop; 38 for(i = 20; i; i--) nop;
37 GPIOB_PIN(4) = 0x10; 39 GPIOB_PIN(4) = 1<<4;
38} 40}
39 41
40unsigned read_GPIOA_67(void) 42unsigned read_GPIOA_67(void)
@@ -74,29 +76,23 @@ int button_read_device(void)
74 volatile int delay; 76 volatile int delay;
75 static bool hold_button_old = false; 77 static bool hold_button_old = false;
76 static long power_counter = 0; 78 static long power_counter = 0;
77 unsigned gpiod = GPIOD_DATA;
78 unsigned gpioa_dir = GPIOA_DIR;
79 unsigned gpiod6; 79 unsigned gpiod6;
80
80 get_scrollwheel(); 81 get_scrollwheel();
81 for(delay = 500; delay; delay--) nop; 82
82 CCU_IO &= ~(1<<12); 83 CCU_IO &= ~(1<<12);
83 for(delay=8;delay;delay--) nop; 84 for(delay=8;delay;delay--) nop;
84 GPIOB_DIR |= 1<<3; 85
85 GPIOB_PIN(3) = 1<<3; 86 GPIOB_PIN(3) = 1<<3;
86 GPIOC_DIR = 0; 87 GPIOB_PIN(0) = 1<<0;
87 GPIOB_DIR &= ~(1<<1); 88
88 GPIOB_DIR |= 1<<0;
89 GPIOB_PIN(0) = 1;
90 for(delay = 500; delay; delay--) 89 for(delay = 500; delay; delay--)
91 nop; 90 nop;
92 gpiod6 = GPIOD_PIN(6); 91 gpiod6 = GPIOD_PIN(6);
93 GPIOB_PIN(0) = 0; 92 GPIOB_PIN(0) = 0;
94 for(delay = 240; delay; delay--) 93 for(delay = 240; delay; delay--)
95 nop; 94 nop;
96 GPIOD_DIR = 0xff; 95
97 GPIOA_DIR &= ~(1<<6|1<<7);
98 GPIOD_DATA = 0;
99 GPIOD_DIR = 0;
100 if (GPIOC_PIN(1) & 1<<1) 96 if (GPIOC_PIN(1) & 1<<1)
101 btn |= BUTTON_DOWN; 97 btn |= BUTTON_DOWN;
102 if (GPIOC_PIN(2) & 1<<2) 98 if (GPIOC_PIN(2) & 1<<2)
@@ -123,11 +119,8 @@ int button_read_device(void)
123 } 119 }
124 } 120 }
125 121
126 GPIOD_DIR = 0xff;
127 GPIOD_DATA = gpiod;
128 GPIOA_DIR = gpioa_dir;
129 GPIOD_DIR = 0;
130 CCU_IO |= 1<<12; 122 CCU_IO |= 1<<12;
123
131#ifdef HAS_BUTTON_HOLD 124#ifdef HAS_BUTTON_HOLD
132#ifndef BOOTLOADER 125#ifndef BOOTLOADER
133 /* light handling */ 126 /* light handling */
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c
index f3fa8e3205..9797815d23 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c
@@ -221,9 +221,8 @@ void lcd_init_device(void)
221 GPIOA_PIN(0) = 1; 221 GPIOA_PIN(0) = 1;
222 GPIOA_PIN(4) = 0; 222 GPIOA_PIN(4) = 0;
223 223
224 GPIOB_DIR |= 0xf; 224 GPIOB_DIR |= (1<<0)|(1<<2)|(1<<3);
225 GPIOB_PIN(0) = 1<<0; 225 GPIOB_PIN(0) = 1<<0;
226 GPIOB_PIN(1) = 1<<1;
227 GPIOB_PIN(2) = 1<<2; 226 GPIOB_PIN(2) = 1<<2;
228 GPIOB_PIN(3) = 1<<3; 227 GPIOB_PIN(3) = 1<<3;
229 228