mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
xduoox3: Rework how we detect "charging" state
The "charging" status is apparently "charging needed" as it is asserted even when power is not being supplied. So first check to see if USB is connected, and if so, then check the "charging" status. Change-Id: I3050f187e0b6c9d97d25d80015b413cd02e5c3b2
This commit is contained in:
parent
0a2a90c182
commit
39285d06d5
1 changed files with 2 additions and 8 deletions
|
|
@ -29,13 +29,7 @@
|
|||
/* Detect which power sources are present. */
|
||||
unsigned int power_input_status(void)
|
||||
{
|
||||
int rval = POWER_INPUT_NONE;
|
||||
if(!__gpio_get_pin(PIN_USB_DET))
|
||||
rval |= POWER_INPUT_USB;
|
||||
if(!__gpio_get_pin(CHARGE_STAT_GPIO))
|
||||
rval |= POWER_INPUT_USB_CHARGER;
|
||||
|
||||
return rval;
|
||||
return !__gpio_get_pin(PIN_USB_DET) ? POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
|
||||
}
|
||||
|
||||
void power_init(void)
|
||||
|
|
@ -46,5 +40,5 @@ void power_init(void)
|
|||
|
||||
bool charging_state(void)
|
||||
{
|
||||
return (power_input_status() & POWER_INPUT_USB_CHARGER);
|
||||
return power_input_status() && !__gpio_get_pin(CHARGE_STAT_GPIO);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue