diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c index 4a818d6bfc..a80663d0d6 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c | |||
@@ -76,6 +76,16 @@ int button_read_device(void) | |||
76 | /* Only one button can be sensed at a time on the remote. */ | 76 | /* Only one button can be sensed at a time on the remote. */ |
77 | /* Need to filter the remote button because the ADC is so fast */ | 77 | /* Need to filter the remote button because the ADC is so fast */ |
78 | remote_adc = adc_read(ADC_HPREMOTE); | 78 | remote_adc = adc_read(ADC_HPREMOTE); |
79 | |||
80 | if (remote_adc != ADC_READ_ERROR) | ||
81 | { | ||
82 | /* If there is nothing in the headphone socket, the ADC reads high */ | ||
83 | if (remote_adc < 940) | ||
84 | headphones_detect = true; | ||
85 | else | ||
86 | headphones_detect = false; | ||
87 | } | ||
88 | |||
79 | btn = remote_buttons[(remote_adc + 64) / 128]; | 89 | btn = remote_buttons[(remote_adc + 64) / 128]; |
80 | if (btn != lastbutton) | 90 | if (btn != lastbutton) |
81 | { | 91 | { |
@@ -136,14 +146,5 @@ int button_read_device(void) | |||
136 | 146 | ||
137 | bool headphones_inserted(void) | 147 | bool headphones_inserted(void) |
138 | { | 148 | { |
139 | unsigned short remote_adc = adc_read(ADC_HPREMOTE); | ||
140 | if (remote_adc != ADC_READ_ERROR) | ||
141 | { | ||
142 | /* If there is nothing in the headphone socket, the ADC reads high */ | ||
143 | if (remote_adc < 940) | ||
144 | headphones_detect = true; | ||
145 | else | ||
146 | headphones_detect = false; | ||
147 | } | ||
148 | return headphones_detect; | 149 | return headphones_detect; |
149 | } | 150 | } |