oryp6: Invert battery leds

This commit is contained in:
Jeremy Soller
2020-06-23 09:09:54 -06:00
parent 84275cd3ba
commit 1c04c6aa39
3 changed files with 13 additions and 12 deletions

View File

@ -61,20 +61,21 @@ void board_event(void) {
}
if (main_cycle == 0) {
// Battery LED's are inverted on the oryp6
if (acin) {
// Discharging (no AC adapter)
gpio_set(&LED_BAT_CHG, false);
gpio_set(&LED_BAT_FULL, false);
gpio_set(&LED_BAT_CHG_N, true);
gpio_set(&LED_BAT_FULL_N, true);
} else if (battery_status & 0x0020) {
// Fully charged
// TODO: turn off charger
gpio_set(&LED_BAT_CHG, false);
gpio_set(&LED_BAT_FULL, true);
gpio_set(&LED_BAT_CHG_N, true);
gpio_set(&LED_BAT_FULL_N, false);
} else {
// Charging
// TODO: detect no battery connected
gpio_set(&LED_BAT_CHG, true);
gpio_set(&LED_BAT_FULL, false);
gpio_set(&LED_BAT_CHG_N, false);
gpio_set(&LED_BAT_FULL_N, true);
}
if (power_state == POWER_STATE_S0 || power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3) {

View File

@ -14,8 +14,8 @@ struct Gpio __code EC_EN = GPIO(B, 6); // renamed to SUSBC_EN
struct Gpio __code EC_RSMRST_N = GPIO(E, 5);
struct Gpio __code GC6_FB_EN = GPIO(J, 7);
struct Gpio __code LED_ACIN = GPIO(C, 7);
struct Gpio __code LED_BAT_CHG = GPIO(H, 5);
struct Gpio __code LED_BAT_FULL = GPIO(J, 0);
struct Gpio __code LED_BAT_CHG_N = GPIO(H, 5);
struct Gpio __code LED_BAT_FULL_N = GPIO(J, 0);
struct Gpio __code LED_PWR = GPIO(D, 0);
struct Gpio __code LID_SW_N = GPIO(B, 1);
struct Gpio __code PM_PWROK = GPIO(C, 6);
@ -49,9 +49,9 @@ void gpio_init() {
GPDRE = 0x08;
GPDRF = 0x40;
GPDRG = 0x40;
GPDRH = 0x00;
GPDRH = 0x20;
GPDRI = 0x20;
GPDRJ = 0x02;
GPDRJ = 0x03;
// Set GPIO control
// EC_PWM_PIN_24

View File

@ -26,8 +26,8 @@ extern struct Gpio __code EC_RSMRST_N;
extern struct Gpio __code GC6_FB_EN;
extern struct Gpio __code LED_ACIN;
extern struct Gpio __code LED_AIRPLANE_N;
extern struct Gpio __code LED_BAT_CHG;
extern struct Gpio __code LED_BAT_FULL;
extern struct Gpio __code LED_BAT_CHG_N;
extern struct Gpio __code LED_BAT_FULL_N;
extern struct Gpio __code LED_PWR;
extern struct Gpio __code LID_SW_N;
#define HAVE_PCH_DPWROK_EC 0