summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/tcc77x/c100/button-c100.c23
-rw-r--r--firmware/target/arm/tcc77x/c100/button-target.h12
2 files changed, 18 insertions, 17 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)
diff --git a/firmware/target/arm/tcc77x/c100/button-target.h b/firmware/target/arm/tcc77x/c100/button-target.h
index acf80b2ed7..73c04b6ed6 100644
--- a/firmware/target/arm/tcc77x/c100/button-target.h
+++ b/firmware/target/arm/tcc77x/c100/button-target.h
@@ -32,23 +32,23 @@ int button_read_device(void);
32bool button_hold(void); 32bool button_hold(void);
33 33
34/* Main unit's buttons */ 34/* Main unit's buttons */
35#define BUTTON_MENU 0x00000001 35#define BUTTON_POWER 0x00000001
36#define BUTTON_VOLUP 0x00000002 36#define BUTTON_VOLUP 0x00000002
37#define BUTTON_VOLDOWN 0x00000004 37#define BUTTON_VOLDOWN 0x00000004
38#define BUTTON_PLAYPAUSE 0x00000008 38#define BUTTON_UP 0x00000008
39#define BUTTON_REPEATAB 0x00000010 39#define BUTTON_DOWN 0x00000010
40#define BUTTON_LEFT 0x00000020 40#define BUTTON_LEFT 0x00000020
41#define BUTTON_RIGHT 0x00000040 41#define BUTTON_RIGHT 0x00000040
42#define BUTTON_SELECT 0x00000080 42#define BUTTON_SELECT 0x00000080
43 43
44#define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\ 44#define BUTTON_MAIN (BUTTON_POWER|BUTTON_VOLUP|BUTTON_VOLDOWN\
45 |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\ 45 |BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT\
46 |BUTTON_RIGHT|BUTTON_SELECT) 46 |BUTTON_RIGHT|BUTTON_SELECT)
47 47
48#define BUTTON_REMOTE 0 48#define BUTTON_REMOTE 0
49 49
50/* Software power-off */ 50/* Software power-off */
51#define POWEROFF_BUTTON BUTTON_MENU 51#define POWEROFF_BUTTON BUTTON_POWER
52#define POWEROFF_COUNT 40 52#define POWEROFF_COUNT 40
53 53
54#endif /* _BUTTON_TARGET_H_ */ 54#endif /* _BUTTON_TARGET_H_ */