diff options
Diffstat (limited to 'keyboards/hhkb/rn42/battery.h')
| -rw-r--r-- | keyboards/hhkb/rn42/battery.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/keyboards/hhkb/rn42/battery.h b/keyboards/hhkb/rn42/battery.h new file mode 100644 index 000000000..180d4dcfa --- /dev/null +++ b/keyboards/hhkb/rn42/battery.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #ifndef POWER_H | ||
| 2 | #define POWER_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | |||
| 7 | typedef enum { | ||
| 8 | FULL_CHARGED, | ||
| 9 | CHARGING, | ||
| 10 | DISCHARGING, | ||
| 11 | LOW_VOLTAGE, | ||
| 12 | UNKNOWN, | ||
| 13 | } battery_status_t; | ||
| 14 | |||
| 15 | typedef enum { | ||
| 16 | LED_CHARGER = 0, | ||
| 17 | LED_ON, | ||
| 18 | LED_OFF, | ||
| 19 | LED_TOGGLE, | ||
| 20 | } battery_led_t; | ||
| 21 | |||
| 22 | /* Battery API */ | ||
| 23 | void battery_init(void); | ||
| 24 | void battery_led(battery_led_t val); | ||
| 25 | bool battery_charging(void); | ||
| 26 | uint16_t battery_voltage(void); | ||
| 27 | battery_status_t battery_status(void); | ||
| 28 | |||
| 29 | #define BATTERY_VOLTAGE_LOW_LIMIT 3500 | ||
| 30 | #define BATTERY_VOLTAGE_LOW_RECOVERY 3700 | ||
| 31 | // ADC offset:16, resolution:5mV | ||
| 32 | #define BATTERY_ADC_OFFSET 16 | ||
| 33 | #define BATTERY_ADC_RESOLUTION 5 | ||
| 34 | |||
| 35 | #endif | ||
