diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/button.c | 28 | ||||
-rw-r--r-- | firmware/export/button.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipod4g.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipodcolor.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipodnano.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipodvideo.h | 3 | ||||
-rw-r--r-- | firmware/export/kernel.h | 2 |
7 files changed, 45 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 | |||
diff --git a/firmware/export/button.h b/firmware/export/button.h index 0e11da9da5..39dfbff6fa 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -54,6 +54,9 @@ bool button_hold(void); | |||
54 | #ifdef HAS_REMOTE_BUTTON_HOLD | 54 | #ifdef HAS_REMOTE_BUTTON_HOLD |
55 | bool remote_button_hold(void); | 55 | bool remote_button_hold(void); |
56 | #endif | 56 | #endif |
57 | #ifdef HAVE_HEADPHONE_DETECTION | ||
58 | bool headphones_inserted(void); | ||
59 | #endif | ||
57 | 60 | ||
58 | 61 | ||
59 | #define BUTTON_NONE 0x00000000 | 62 | #define BUTTON_NONE 0x00000000 |
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index a5f186782f..2e8c4dcc33 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -109,6 +109,9 @@ | |||
109 | /* Define this if you have adjustable CPU frequency */ | 109 | /* Define this if you have adjustable CPU frequency */ |
110 | #define HAVE_ADJUSTABLE_CPU_FREQ | 110 | #define HAVE_ADJUSTABLE_CPU_FREQ |
111 | 111 | ||
112 | /* Define this if you can detect headphones */ | ||
113 | #define HAVE_HEADPHONE_DETECTION | ||
114 | |||
112 | #define BOOTFILE_EXT "ipod" | 115 | #define BOOTFILE_EXT "ipod" |
113 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 116 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
114 | 117 | ||
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 3366baa8ea..964f103214 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -105,6 +105,9 @@ | |||
105 | /* Define this if you have adjustable CPU frequency */ | 105 | /* Define this if you have adjustable CPU frequency */ |
106 | #define HAVE_ADJUSTABLE_CPU_FREQ | 106 | #define HAVE_ADJUSTABLE_CPU_FREQ |
107 | 107 | ||
108 | /* Define this if you can detect headphones */ | ||
109 | #define HAVE_HEADPHONE_DETECTION | ||
110 | |||
108 | #define BOOTFILE_EXT "ipod" | 111 | #define BOOTFILE_EXT "ipod" |
109 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 112 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
110 | 113 | ||
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index c077c381f8..03f5b8c753 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -110,6 +110,9 @@ | |||
110 | /* Define this if you have adjustable CPU frequency */ | 110 | /* Define this if you have adjustable CPU frequency */ |
111 | #define HAVE_ADJUSTABLE_CPU_FREQ | 111 | #define HAVE_ADJUSTABLE_CPU_FREQ |
112 | 112 | ||
113 | /* Define this if you can detect headphones */ | ||
114 | #define HAVE_HEADPHONE_DETECTION | ||
115 | |||
113 | #define BOOTFILE_EXT "ipod" | 116 | #define BOOTFILE_EXT "ipod" |
114 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 117 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
115 | 118 | ||
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 5cea64deb4..4781a2c887 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -110,6 +110,9 @@ | |||
110 | /* Define this if you have adjustable CPU frequency */ | 110 | /* Define this if you have adjustable CPU frequency */ |
111 | #define HAVE_ADJUSTABLE_CPU_FREQ | 111 | #define HAVE_ADJUSTABLE_CPU_FREQ |
112 | 112 | ||
113 | /* Define this if you can detect headphones */ | ||
114 | #define HAVE_HEADPHONE_DETECTION | ||
115 | |||
113 | #define BOOTFILE_EXT "ipod" | 116 | #define BOOTFILE_EXT "ipod" |
114 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 117 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
115 | 118 | ||
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 482516b9dc..fcab2d923c 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h | |||
@@ -46,6 +46,8 @@ | |||
46 | #define SYS_FS_CHANGED ((SYS_EVENT | ((long)9 << 27))) | 46 | #define SYS_FS_CHANGED ((SYS_EVENT | ((long)9 << 27))) |
47 | #define SYS_CHARGER_CONNECTED ((SYS_EVENT | ((long)10 << 27))) | 47 | #define SYS_CHARGER_CONNECTED ((SYS_EVENT | ((long)10 << 27))) |
48 | #define SYS_CHARGER_DISCONNECTED ((SYS_EVENT | ((long)11 << 27))) | 48 | #define SYS_CHARGER_DISCONNECTED ((SYS_EVENT | ((long)11 << 27))) |
49 | #define SYS_PHONE_PLUGGED ((SYS_EVENT | ((long)12 << 27))) | ||
50 | #define SYS_PHONE_UNPLUGGED ((SYS_EVENT | ((long)13 << 27))) | ||
49 | 51 | ||
50 | struct event | 52 | struct event |
51 | { | 53 | { |