Set input current limits

This commit is contained in:
Jeremy Soller 2020-04-05 10:34:25 -06:00
parent d901907942
commit e8f8daae1b
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 26 additions and 2 deletions

View File

@ -34,6 +34,10 @@ int battery_charger_disable(void) {
res = smbus_write(0x09, 0x15, 0);
if (res < 0) return res;
// Disable input current
res = smbus_write(0x09, 0x3F, 0);
if (res < 0) return res;
return 0;
}
@ -51,6 +55,10 @@ int battery_charger_enable(void) {
res = smbus_write(0x09, 0x15, 0x44CB);
if (res < 0) return res;
// Set input current to ~3.2 A
res = smbus_write(0x09, 0x3F, 0x0C80);
if (res < 0) return res;
// Set charge option 0 with watchdog disabled
res = smbus_write(
0x09,

View File

@ -34,6 +34,10 @@ int battery_charger_disable(void) {
res = smbus_write(0x09, 0x15, 0);
if (res < 0) return res;
// Disable input current
res = smbus_write(0x09, 0x3F, 0);
if (res < 0) return res;
return 0;
}
@ -51,6 +55,10 @@ int battery_charger_enable(void) {
res = smbus_write(0x09, 0x15, 0x3300);
if (res < 0) return res;
// Set input current to ~1.92 A
res = smbus_write(0x09, 0x3F, 0x0780);
if (res < 0) return res;
// Set charge option 0 with watchdog disabled
res = smbus_write(
0x09,

View File

@ -33,6 +33,10 @@ int battery_charger_disable(void) {
res = smbus_write(0x09, 0x15, 0);
if (res < 0) return res;
// Disable input current
res = smbus_write(0x09, 0x3F, 0);
if (res < 0) return res;
return 0;
}
@ -42,14 +46,18 @@ int battery_charger_enable(void) {
res = battery_charger_disable();
if (res < 0) return res;
// Set charge current to 3.264 A / 2
res = smbus_write(0x09, 0x14, 0x0CF2 / 2);
// Set charge current to ~1.54A
res = smbus_write(0x09, 0x14, 0x061C);
if (res < 0) return res;
// Set charge voltage to 8.8 V
res = smbus_write(0x09, 0x15, 0x2260);
if (res < 0) return res;
// Set input current to ~3.2 A
res = smbus_write(0x09, 0x3F, 0x0C80);
if (res < 0) return res;
// Set charge option 0 with watchdog disabled
res = smbus_write(
0x09,