Reduce smbus speed to 50 KHz

This commit is contained in:
Jeremy Soller 2019-11-10 20:25:15 -07:00
parent 7b30477009
commit 285e9bc437
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
2 changed files with 9 additions and 6 deletions

View File

@ -56,7 +56,7 @@ void ac_adapter() {
static struct Gpio __code ACIN_N = GPIO(B, 6);
static struct Gpio __code LED_ACIN = GPIO(C, 7);
static bool last = false;
static bool last = true;
// Check if the adapter line goes low
bool new = gpio_get(&ACIN_N);
@ -68,9 +68,12 @@ void ac_adapter() {
printf("Power adapter ");
if (new) {
printf("unplugged\n");
battery_charger_disable();
} else {
printf("plugged in\n");
battery_charger_enable();
}
battery_debug();
}
last = new;

View File

@ -9,8 +9,8 @@ void smbus_init(void) {
SMB45P3USL = 0x5C;
SMB45P3USH = 0x01;
// Clock to 400 KHz
SCLKTSA = 3;
// Clock to 50 KHz
SCLKTSA = 1;
// Enable host interface
HOCTL2A = 1 << 0;