summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/c100/button-c100.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/c100/button-c100.c')
-rw-r--r--firmware/target/arm/tcc77x/c100/button-c100.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/firmware/target/arm/tcc77x/c100/button-c100.c b/firmware/target/arm/tcc77x/c100/button-c100.c
index c3d04f7016..ebf92f780c 100644
--- a/firmware/target/arm/tcc77x/c100/button-c100.c
+++ b/firmware/target/arm/tcc77x/c100/button-c100.c
@@ -31,30 +31,31 @@ void button_init_device(void)
31int button_read_device(void) 31int button_read_device(void)
32{ 32{
33 int btn = BUTTON_NONE; 33 int btn = BUTTON_NONE;
34 34
35 if (!button_hold()){ 35 if (!button_hold())
36 {
36 GPIOA |= 0x4; 37 GPIOA |= 0x4;
37 GPIOA &= ~0x8; 38 GPIOA &= ~0x8;
38 39
39 int i=20; while (i--); 40 int i=20; while (i--);
40 41
41 if (GPIOA & 0x10) btn |= BUTTON_PLAYPAUSE; /* up */ 42 if (GPIOA & 0x10) btn |= BUTTON_UP;
42 if (GPIOA & 0x20) btn |= BUTTON_RIGHT; 43 if (GPIOA & 0x20) btn |= BUTTON_RIGHT;
43 if (GPIOA & 0x40) btn |= BUTTON_LEFT; 44 if (GPIOA & 0x40) btn |= BUTTON_LEFT;
44 45
45 GPIOA |= 0x8; 46 GPIOA |= 0x8;
46 GPIOA &= ~0x4; 47 GPIOA &= ~0x4;
47 48
48 i=20; while (i--); 49 i=20; while (i--);
49 50
50 if (GPIOA & 0x10) btn |= BUTTON_VOLUP; 51 if (GPIOA & 0x10) btn |= BUTTON_VOLUP;
51 if (GPIOA & 0x20) btn |= BUTTON_VOLDOWN; 52 if (GPIOA & 0x20) btn |= BUTTON_VOLDOWN;
52 if (GPIOA & 0x40) btn |= BUTTON_REPEATAB; /* down */ 53 if (GPIOA & 0x40) btn |= BUTTON_DOWN;
53 54
54 if (GPIOA & 0x80) btn |= BUTTON_SELECT; 55 if (GPIOA & 0x80) btn |= BUTTON_SELECT;
55 if (GPIOA & 0x100) btn |= BUTTON_MENU; 56 if (GPIOA & 0x100) btn |= BUTTON_POWER;
56 } 57 }
57 return btn; 58 return btn;
58} 59}
59 60
60bool button_hold(void) 61bool button_hold(void)