mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
xduoox3: Try to distinguish between "USB Plugged in" and "Charging"
Change-Id: I1879dbe6a95df215afa32012a72e1431c03a8653
This commit is contained in:
parent
06986d27f0
commit
f3026cd072
1 changed files with 8 additions and 4 deletions
|
@ -24,14 +24,18 @@
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
#define CHARGE_STAT_GPIO (32*1+6) /* STAT port */
|
#define CHARGE_STAT_GPIO (32*1+6) /* STAT port */
|
||||||
|
#define PIN_USB_DET (32*4+19) /* USB connected */
|
||||||
|
|
||||||
/* Detect which power sources are present. */
|
/* Detect which power sources are present. */
|
||||||
unsigned int power_input_status(void)
|
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))
|
if(!__gpio_get_pin(CHARGE_STAT_GPIO))
|
||||||
return POWER_INPUT_USB_CHARGER;
|
rval |= POWER_INPUT_USB_CHARGER;
|
||||||
|
|
||||||
return POWER_INPUT_NONE;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void power_init(void)
|
void power_init(void)
|
||||||
|
@ -42,5 +46,5 @@ void power_init(void)
|
||||||
|
|
||||||
bool charging_state(void)
|
bool charging_state(void)
|
||||||
{
|
{
|
||||||
return (power_input_status() == POWER_INPUT_USB_CHARGER);
|
return (power_input_status() & POWER_INPUT_USB_CHARGER);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue