forked from len0rd/rockbox
Fix battery meter on Sansa Connect.
Use the battery capacity percents reported by AVR. Internally fake linear voltage scale is used (1 mV = 1%). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31049 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e1949696d9
commit
62f5027650
2 changed files with 20 additions and 5 deletions
|
|
@ -297,6 +297,8 @@ void avr_hid_init(void)
|
|||
avr_hid_sync();
|
||||
}
|
||||
|
||||
/* defined in powermgmt-sansaconnect.c */
|
||||
void set_battery_level(unsigned int level);
|
||||
|
||||
static void avr_hid_get_state(void)
|
||||
{
|
||||
|
|
@ -309,6 +311,12 @@ static void avr_hid_get_state(void)
|
|||
|
||||
spi_txrx(cmd, buf, sizeof(cmd));
|
||||
|
||||
/*
|
||||
* buf[8] contains some battery/charger related information (unknown)
|
||||
* buf[9] contains battery level in percents (0-100)
|
||||
*/
|
||||
set_battery_level((unsigned int)buf[9]);
|
||||
|
||||
spi_txrx(cmd_empty, NULL, 1); /* request interrupt on button press */
|
||||
|
||||
parse_button_state(buf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue