diff options
Diffstat (limited to 'keyboards')
112 files changed, 9260 insertions, 187 deletions
diff --git a/keyboards/keychron/bluetooth/battery.c b/keyboards/keychron/bluetooth/battery.c index 6dd453357e..bc463f9336 100644 --- a/keyboards/keychron/bluetooth/battery.c +++ b/keyboards/keychron/bluetooth/battery.c @@ -20,6 +20,8 @@ #include "transport.h" #include "ckbt51.h" #include "lpm.h" +#include "indicator.h" +#include "rtc_timer.h" #define BATTERY_EMPTY_COUNT 10 #define CRITICAL_LOW_COUNT 20 @@ -29,12 +31,14 @@ static uint16_t voltage = FULL_VOLTAGE_VALUE; static uint8_t bat_empty = 0; static uint8_t critical_low = 0; static uint8_t bat_state; +static uint8_t power_on_sample = 0; void battery_init(void) { - bat_monitor_timer_buffer = 0; bat_state = BAT_NOT_CHARGING; } -__attribute__((weak)) void battery_measure(void) {} +__attribute__((weak)) void battery_measure(void) { + ckbt51_read_state_reg(0x05, 0x02); +} /* Calculate the voltage */ __attribute__((weak)) void battery_calculate_voltage(uint16_t value) {} @@ -71,10 +75,16 @@ bool battery_is_critical_low(void) { void battery_check_empty(void) { if (voltage < EMPTY_VOLTAGE_VALUE) { if (bat_empty <= BATTERY_EMPTY_COUNT) { - if (++bat_empty > BATTERY_EMPTY_COUNT) indicator_battery_low_enable(true); + if (++bat_empty > BATTERY_EMPTY_COUNT) { +#ifdef BAT_LOW_LED_PIN + indicator_battery_low_enable(true); +#endif +#if defined(LOW_BAT_IND_INDEX) + indicator_battery_low_backlit_enable(true); +#endif |