diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-09-26 10:03:56 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-09-26 10:03:56 +0000 |
commit | 537c7546f946d266e55fdbce03558352a3342908 (patch) | |
tree | 9e594c9d40ec54047fa858472f737bc4d7b7d406 /firmware/drivers | |
parent | 9f960e405f72e1f624797547e1ad8e9584206118 (diff) | |
download | rockbox-537c7546f946d266e55fdbce03558352a3342908.tar.gz rockbox-537c7546f946d266e55fdbce03558352a3342908.zip |
Patch #4899 by Robert Keevil - Automatic pause on iPod when removing the headphones
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11057 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/button.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 5add6cb817..0042d9b8eb 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -92,6 +92,10 @@ static bool remote_button_hold_only(void); | |||
92 | int int_btn = BUTTON_NONE; | 92 | int int_btn = BUTTON_NONE; |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | #ifdef HAVE_HEADPHONE_DETECTION | ||
96 | bool phones_present = false; | ||
97 | #endif | ||
98 | |||
95 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI) | 99 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI) |
96 | static void opto_i2c_init(void) | 100 | static void opto_i2c_init(void) |
97 | { | 101 | { |
@@ -433,6 +437,23 @@ static void button_tick(void) | |||
433 | } | 437 | } |
434 | #endif | 438 | #endif |
435 | 439 | ||
440 | #ifdef HAVE_HEADPHONE_DETECTION | ||
441 | if ( headphones_inserted() ) | ||
442 | { | ||
443 | if (! phones_present ) | ||
444 | { | ||
445 | queue_post(&button_queue, SYS_PHONE_PLUGGED, NULL); | ||
446 | phones_present = true; | ||
447 | } | ||
448 | } else { | ||
449 | if ( phones_present ) | ||
450 | { | ||
451 | queue_post(&button_queue, SYS_PHONE_UNPLUGGED, NULL); | ||
452 | phones_present = false; | ||
453 | } | ||
454 | } | ||
455 | #endif | ||
456 | |||
436 | btn = button_read(); | 457 | btn = button_read(); |
437 | 458 | ||
438 | /* Find out if a key has been released */ | 459 | /* Find out if a key has been released */ |
@@ -1327,3 +1348,10 @@ void button_clear_queue(void) | |||
1327 | queue_clear(&button_queue); | 1348 | queue_clear(&button_queue); |
1328 | } | 1349 | } |
1329 | 1350 | ||
1351 | #ifdef HAVE_HEADPHONE_DETECTION | ||
1352 | bool headphones_inserted(void) | ||
1353 | { | ||
1354 | return (GPIOA_INPUT_VAL & 0x80)?true:false; | ||
1355 | } | ||
1356 | #endif | ||
1357 | |||