#pragma once #include // 18650 battery monitoring, read through the onboard divider on ADC1_CH3. // // The divider sits on the battery node, downstream of the charger, so there is // no way to tell "charging" from "full" here — only the cell voltage is // reported. See CLAUDE.md. namespace battery { void begin(); // Samples the divider if BATTERY_READ_MS has elapsed. Call from loop(). void loop(); // Forces a reading now. void sample(); // True once a plausible reading has been taken. False on a board with no cell // fitted and no sensible voltage present. bool hasReading(); // Cell voltage in volts. float volts(); // Remaining charge, 0-100, from a lithium-ion discharge curve. uint8_t percent(); } // namespace battery