System76 common board directory (#53)
* Move configuration for battery into board.mk * lemp9: remove tcpm code * Move touchpad to its own module * Add kbled_reset to all platforms, move items to run on CPU reset to a function * Add defines for battery and charger address * Add I2C_0 export to it5570e * Move common system76 board functions into src/board/system76/common
This commit is contained in:
30
src/board/system76/galp3-c/board.c
Normal file
30
src/board/system76/galp3-c/board.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <board/battery.h>
|
||||
#include <board/board.h>
|
||||
#include <board/gctrl.h>
|
||||
#include <board/gpio.h>
|
||||
|
||||
extern uint8_t main_cycle;
|
||||
|
||||
void board_init(void) {
|
||||
RSTS = 0x84;
|
||||
}
|
||||
|
||||
void board_event(void) {
|
||||
if (main_cycle == 0) {
|
||||
if (gpio_get(&ACIN_N)) {
|
||||
// Discharging (no AC adapter)
|
||||
gpio_set(&LED_BAT_CHG, false);
|
||||
gpio_set(&LED_BAT_FULL, false);
|
||||
} else if (battery_status & 0x0020) {
|
||||
// Fully charged
|
||||
// TODO: turn off charger
|
||||
gpio_set(&LED_BAT_CHG, false);
|
||||
gpio_set(&LED_BAT_FULL, true);
|
||||
} else {
|
||||
// Charging
|
||||
// TODO: detect no battery connected
|
||||
gpio_set(&LED_BAT_CHG, true);
|
||||
gpio_set(&LED_BAT_FULL, false);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user