diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index 4848d9e..869cc16 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -32,9 +32,10 @@ static bool hold_button = false;
void button_init_device(void)
{ /* activate the wheel */
volatile int i;
- GPIOB_DIR |= 1<<4;
+ GPIOA_DIR &= ~(1<<6|1<<7);
+ GPIOB_DIR |= (1<<4)|(1<<3)|(1<<0);
for(i = 20; i; i--) nop;
- GPIOB_PIN(4) = 0x10;
+ GPIOB_PIN(4) = 1<<4;
}

unsigned read_GPIOA_67(void)
@@ -74,29 +75,24 @@ int button_read_device(void)
volatile int delay;
static bool hold_button_old = false;
static long power_counter = 0;
- unsigned gpiod = GPIOD_DATA;
- unsigned gpioa_dir = GPIOA_DIR;
unsigned gpiod6;
+
get_scrollwheel();
- for(delay = 500; delay; delay--) nop;
+
CCU_IO &= ~(1<<12);
for(delay=8;delay;delay--) nop;
- GPIOB_DIR |= 1<<3;
+
GPIOB_PIN(3) = 1<<3;
+ GPIOB_PIN(0) = 1<<0;
GPIOC_DIR = 0;
- GPIOB_DIR &= ~(1<<1);
- GPIOB_DIR |= 1<<0;
- GPIOB_PIN(0) = 1;
+
for(delay = 500; delay; delay--)
nop;
gpiod6 = GPIOD_PIN(6);
GPIOB_PIN(0) = 0;
for(delay = 240; delay; delay--)
nop;
- GPIOD_DIR = 0xff;
- GPIOA_DIR &= ~(1<<6|1<<7);
- GPIOD_DATA = 0;
- GPIOD_DIR = 0;
+
if (GPIOC_PIN(1) & 1<<1)
btn |= BUTTON_DOWN;
if (GPIOC_PIN(2) & 1<<2)
@@ -123,11 +119,8 @@ int button_read_device(void)
}
}

- GPIOD_DIR = 0xff;
- GPIOD_DATA = gpiod;
- GPIOA_DIR = gpioa_dir;
- GPIOD_DIR = 0;
CCU_IO |= 1<<12;
+
#ifdef HAS_BUTTON_HOLD
#ifndef BOOTLOADER
/* 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 f3fa8e3..9797815 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)
GPIOA_PIN(0) = 1;
GPIOA_PIN(4) = 0;

- GPIOB_DIR |= 0xf;
+ GPIOB_DIR |= (1<<0)|(1<<2)|(1<<3);
GPIOB_PIN(0) = 1<<0;
- GPIOB_PIN(1) = 1<<1;
GPIOB_PIN(2) = 1<<2;
GPIOB_PIN(3) = 1<<3;