mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Fuzev2: simplify button_read_device()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25636 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f830fa79e5
commit
482fefd928
2 changed files with 12 additions and 20 deletions
|
|
@ -32,9 +32,11 @@ static bool hold_button = false;
|
||||||
void button_init_device(void)
|
void button_init_device(void)
|
||||||
{ /* activate the wheel */
|
{ /* activate the wheel */
|
||||||
volatile int i;
|
volatile int i;
|
||||||
GPIOB_DIR |= 1<<4;
|
GPIOA_DIR &= ~(1<<6|1<<7);
|
||||||
|
GPIOC_DIR = 0;
|
||||||
|
GPIOB_DIR |= (1<<4)|(1<<3)|(1<<0);
|
||||||
for(i = 20; i; i--) nop;
|
for(i = 20; i; i--) nop;
|
||||||
GPIOB_PIN(4) = 0x10;
|
GPIOB_PIN(4) = 1<<4;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned read_GPIOA_67(void)
|
unsigned read_GPIOA_67(void)
|
||||||
|
|
@ -74,29 +76,23 @@ int button_read_device(void)
|
||||||
volatile int delay;
|
volatile int delay;
|
||||||
static bool hold_button_old = false;
|
static bool hold_button_old = false;
|
||||||
static long power_counter = 0;
|
static long power_counter = 0;
|
||||||
unsigned gpiod = GPIOD_DATA;
|
|
||||||
unsigned gpioa_dir = GPIOA_DIR;
|
|
||||||
unsigned gpiod6;
|
unsigned gpiod6;
|
||||||
|
|
||||||
get_scrollwheel();
|
get_scrollwheel();
|
||||||
for(delay = 500; delay; delay--) nop;
|
|
||||||
CCU_IO &= ~(1<<12);
|
CCU_IO &= ~(1<<12);
|
||||||
for(delay=8;delay;delay--) nop;
|
for(delay=8;delay;delay--) nop;
|
||||||
GPIOB_DIR |= 1<<3;
|
|
||||||
GPIOB_PIN(3) = 1<<3;
|
GPIOB_PIN(3) = 1<<3;
|
||||||
GPIOC_DIR = 0;
|
GPIOB_PIN(0) = 1<<0;
|
||||||
GPIOB_DIR &= ~(1<<1);
|
|
||||||
GPIOB_DIR |= 1<<0;
|
|
||||||
GPIOB_PIN(0) = 1;
|
|
||||||
for(delay = 500; delay; delay--)
|
for(delay = 500; delay; delay--)
|
||||||
nop;
|
nop;
|
||||||
gpiod6 = GPIOD_PIN(6);
|
gpiod6 = GPIOD_PIN(6);
|
||||||
GPIOB_PIN(0) = 0;
|
GPIOB_PIN(0) = 0;
|
||||||
for(delay = 240; delay; delay--)
|
for(delay = 240; delay; delay--)
|
||||||
nop;
|
nop;
|
||||||
GPIOD_DIR = 0xff;
|
|
||||||
GPIOA_DIR &= ~(1<<6|1<<7);
|
|
||||||
GPIOD_DATA = 0;
|
|
||||||
GPIOD_DIR = 0;
|
|
||||||
if (GPIOC_PIN(1) & 1<<1)
|
if (GPIOC_PIN(1) & 1<<1)
|
||||||
btn |= BUTTON_DOWN;
|
btn |= BUTTON_DOWN;
|
||||||
if (GPIOC_PIN(2) & 1<<2)
|
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;
|
CCU_IO |= 1<<12;
|
||||||
|
|
||||||
#ifdef HAS_BUTTON_HOLD
|
#ifdef HAS_BUTTON_HOLD
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
/* light handling */
|
/* light handling */
|
||||||
|
|
|
||||||
|
|
@ -221,9 +221,8 @@ void lcd_init_device(void)
|
||||||
GPIOA_PIN(0) = 1;
|
GPIOA_PIN(0) = 1;
|
||||||
GPIOA_PIN(4) = 0;
|
GPIOA_PIN(4) = 0;
|
||||||
|
|
||||||
GPIOB_DIR |= 0xf;
|
GPIOB_DIR |= (1<<0)|(1<<2)|(1<<3);
|
||||||
GPIOB_PIN(0) = 1<<0;
|
GPIOB_PIN(0) = 1<<0;
|
||||||
GPIOB_PIN(1) = 1<<1;
|
|
||||||
GPIOB_PIN(2) = 1<<2;
|
GPIOB_PIN(2) = 1<<2;
|
||||||
GPIOB_PIN(3) = 1<<3;
|
GPIOB_PIN(3) = 1<<3;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue