diff options
author | tmk <nobody@nowhere> | 2014-09-04 17:08:23 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2014-09-04 17:08:23 +0900 |
commit | 3b81ffc16c8cdf260c25f0778d32c721af4f105c (patch) | |
tree | 4d9ef22491bfc77a0956d87718b715742e07497f /keyboard/hhkb_rn42/rn42/battery.c | |
parent | 02939ab1d831ab7bb02edb28cb0b21fb61bced56 (diff) | |
download | firmware-3b81ffc16c8cdf260c25f0778d32c721af4f105c.tar.gz firmware-3b81ffc16c8cdf260c25f0778d32c721af4f105c.tar.bz2 firmware-3b81ffc16c8cdf260c25f0778d32c721af4f105c.zip |
Monitor battery and alert low voltage
Diffstat (limited to 'keyboard/hhkb_rn42/rn42/battery.c')
-rw-r--r-- | keyboard/hhkb_rn42/rn42/battery.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/keyboard/hhkb_rn42/rn42/battery.c b/keyboard/hhkb_rn42/rn42/battery.c index 32de86448..c6988fe33 100644 --- a/keyboard/hhkb_rn42/rn42/battery.c +++ b/keyboard/hhkb_rn42/rn42/battery.c @@ -49,10 +49,11 @@ bool battery_charging(void) { if (!(USBSTA&(1<<VBUS))) return false; - // MCP73831:STAT - // HiZ: Shutdown/No Battery - // Low: Charging - // Hi: Charged + // Charger Status: + // MCP73831 MCP73832 LTC4054 Status + // Hi-Z Hi-Z Hi-Z Shutdown/No Battery + // Low Low Low Charging + // Hi Hi-Z Hi-Z Charged // preserve last register status uint8_t ddrf_prev = DDRF; @@ -68,6 +69,10 @@ bool battery_charging(void) DDRF = (DDRF&~(1<<5)) | (ddrf_prev&(1<<5)); PORTF = (PORTF&~(1<<5)) | (portf_prev&(1<<5)); + // TODO: With MCP73831 this can not get stable status when charging. + // LED is powered from PSEL line(USB or Lipo) + // due to weak low output of STAT pin? + // due to pull-up'd via resitor and LED? return charging; } |