forked from mirrors/qmk_userspace
Added wireless support; Added Lemokey L3; Added Keychron V1 Max
This commit is contained in:
parent
9539f135d8
commit
4ae5990fcc
31585 changed files with 99327 additions and 1763186 deletions
60
keyboards/keychron/bluetooth/battery.h
Normal file
60
keyboards/keychron/bluetooth/battery.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* Copyright 2022 @ lokher (https://www.keychron.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
enum {
|
||||
BAT_NOT_CHARGING = 0,
|
||||
BAT_CHARGING,
|
||||
BAT_CHARGING_FINISHED,
|
||||
};
|
||||
|
||||
#ifndef FULL_VOLTAGE_VALUE
|
||||
# define FULL_VOLTAGE_VALUE 4100
|
||||
#endif
|
||||
|
||||
#ifndef EMPTY_VOLTAGE_VALUE
|
||||
# define EMPTY_VOLTAGE_VALUE 3500
|
||||
#endif
|
||||
|
||||
#ifndef SHUTDOWN_VOLTAGE_VALUE
|
||||
# define SHUTDOWN_VOLTAGE_VALUE 3300
|
||||
#endif
|
||||
|
||||
#ifndef VOLTAGE_MEASURE_INTERVAL
|
||||
# define VOLTAGE_MEASURE_INTERVAL 3000
|
||||
#endif
|
||||
|
||||
#ifndef VOLTAGE_POWER_ON_MEASURE_COUNT
|
||||
# define VOLTAGE_POWER_ON_MEASURE_COUNT 15
|
||||
#endif
|
||||
|
||||
#ifndef BACKLIGHT_OFF_VOLTAGE_MEASURE_INTERVAL
|
||||
# define BACKLIGHT_OFF_VOLTAGE_MEASURE_INTERVAL 200
|
||||
#endif
|
||||
|
||||
void battery_init(void);
|
||||
void battery_measure(void);
|
||||
void battery_calculte_voltage(uint16_t value);
|
||||
void battery_set_voltage(uint16_t value);
|
||||
uint16_t battery_get_voltage(void);
|
||||
uint8_t battery_get_percentage(void);
|
||||
void indicator_battery_low_enable(bool enable);
|
||||
bool battery_is_empty(void);
|
||||
bool battery_is_critical_low(void);
|
||||
bool battery_power_on_sample(void);
|
||||
|
||||
void battery_task(void);
|
Loading…
Add table
Add a link
Reference in a new issue