mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Add HAVE_LINEOUT_DETECTION and associated logic
This allows targets to automatically switch audio settings when the line out is plugged/unplugged. Only hooked up on the xDuoo X3, but there are other potential users. Change-Id: Ic46a329bc955cca2e2ad0335ca16295eab24ad59
This commit is contained in:
parent
100f4338de
commit
d24edc605b
7 changed files with 110 additions and 28 deletions
|
|
@ -53,6 +53,13 @@ bool headphones_inserted(void)
|
|||
return (__gpio_get_pin(PIN_PH_DECT) != 0);
|
||||
}
|
||||
|
||||
bool lineout_inserted(void)
|
||||
{
|
||||
/* We want to prevent LO being "enabled" if HP is attached
|
||||
to avoid potential eardrum damage */
|
||||
return (__gpio_get_pin(PIN_LO_DECT) == 0) && !headphones_inserted();
|
||||
}
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
key_val = 0xfff;
|
||||
|
|
@ -72,11 +79,11 @@ void button_init_device(void)
|
|||
__gpio_set_pin(PIN_CHARGE_CON); /* 0.7 A */
|
||||
__gpio_as_output(PIN_CHARGE_CON);
|
||||
|
||||
__gpio_as_input(PIN_LO_DECT);
|
||||
__gpio_as_input(PIN_PH_DECT);
|
||||
|
||||
__gpio_disable_pull(PIN_LO_DECT);
|
||||
__gpio_disable_pull(PIN_PH_DECT);
|
||||
|
||||
__gpio_as_input(PIN_LO_DECT);
|
||||
__gpio_disable_pull(PIN_LO_DECT);
|
||||
}
|
||||
|
||||
bool button_hold(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue