summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/ipod/button-clickwheel.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/firmware/target/arm/ipod/button-clickwheel.c b/firmware/target/arm/ipod/button-clickwheel.c
index 632936965a..a43a059692 100644
--- a/firmware/target/arm/ipod/button-clickwheel.c
+++ b/firmware/target/arm/ipod/button-clickwheel.c
@@ -87,6 +87,11 @@ int int_btn = BUTTON_NONE;
87static struct wakeup button_init_wakeup; 87static struct wakeup button_init_wakeup;
88#endif 88#endif
89 89
90#if CONFIG_CPU==S5L8702
91static long holdswitch_last_read;
92static bool holdswitch_last_value;
93#endif
94
90#ifdef CPU_PP 95#ifdef CPU_PP
91static void opto_i2c_init(void) 96static void opto_i2c_init(void)
92{ 97{
@@ -372,7 +377,8 @@ void button_init_device(void)
372#if CONFIG_CPU==S5L8701 377#if CONFIG_CPU==S5L8701
373 INTMSK |= (1<<26); 378 INTMSK |= (1<<26);
374#elif CONFIG_CPU==S5L8702 379#elif CONFIG_CPU==S5L8702
375 //TODO: Implement 380 holdswitch_last_read = USEC_TIMER;
381 holdswitch_last_value = (pmu_read(0x87) & 2) == 0;
376#endif 382#endif
377 s5l_clickwheel_init(); 383 s5l_clickwheel_init();
378 wakeup_wait(&button_init_wakeup, HZ / 10); 384 wakeup_wait(&button_init_wakeup, HZ / 10);
@@ -383,7 +389,12 @@ bool button_hold(void)
383#if CONFIG_CPU==S5L8701 389#if CONFIG_CPU==S5L8701
384 return ((PDAT14 & (1 << 6)) == 0); 390 return ((PDAT14 & (1 << 6)) == 0);
385#elif CONFIG_CPU==S5L8702 391#elif CONFIG_CPU==S5L8702
386 return ((PDATE & (1 << 4)) == 0); 392 if (USEC_TIMER - holdswitch_last_read > 100000)
393 {
394 holdswitch_last_read = USEC_TIMER;
395 holdswitch_last_value = (pmu_read(0x87) & 2) == 0;
396 }
397 return holdswitch_last_value;
387#endif 398#endif
388} 399}
389 400