summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuze/button-fuze.c')
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/button-fuze.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
index ee463ab2de..36a0f3aeda 100644
--- a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
@@ -68,9 +68,58 @@ void clickwheel_int(void)
68#endif /* BOOTLOADER */ 68#endif /* BOOTLOADER */
69 69
70/* device buttons */ 70/* device buttons */
71
72/* device buttons */
71void button_int(void) 73void button_int(void)
72{ 74{
75 int dir_save_b = 0;
76 int afsel_save_b = 0;
77 int dir_save_c = 0;
78 int afsel_save_c = 0;
79
73 int_btn = BUTTON_NONE; 80 int_btn = BUTTON_NONE;
81
82 /* Save the current direction and afsel */
83 dir_save_b = GPIOB_DIR;
84 afsel_save_b = GPIOB_AFSEL;
85 dir_save_c = GPIOC_DIR;
86 afsel_save_c = GPIOC_AFSEL;
87
88 GPIOB_DIR = 0;
89 GPIOB_AFSEL = 0;
90 GPIOC_DIR = 0;
91 GPIOC_AFSEL = 0;
92
93 /* These should not be needed with button event interupts */
94 /* they are necessary now to clear out lcd data */
95 GPIOC_PIN(0) |= 1;
96 GPIOC_PIN(1) |= 1;
97 GPIOC_PIN(2) |= 1;
98 GPIOC_PIN(3) |= 1;
99 GPIOC_PIN(4) |= 1;
100 GPIOC_PIN(5) |= 1;
101 GPIOC_PIN(6) |= 1;
102 GPIOC_PIN(7) |= 1;
103
104 /* direct GPIO connections */
105 if (GPIOB_PIN(4))
106 int_btn |= BUTTON_POWER;
107 if (!GPIOC_PIN(6))
108 int_btn |= BUTTON_DOWN;
109 if (!GPIOC_PIN(5))
110 int_btn |= BUTTON_RIGHT;
111 if (!GPIOC_PIN(4))
112 int_btn |= BUTTON_SELECT;
113 if (!GPIOC_PIN(3))
114 int_btn |= BUTTON_LEFT;
115 if (!GPIOC_PIN(2))
116 int_btn |= BUTTON_UP;
117
118 /* return to settings needed for lcd */
119 GPIOB_DIR = dir_save_b;
120 GPIOB_AFSEL = afsel_save_b;
121 GPIOC_DIR = dir_save_c;
122 GPIOC_AFSEL = afsel_save_c;
74} 123}
75 124
76/* 125/*