summaryrefslogtreecommitdiffstats
path: root/keyboards/hhkb/rn42/battery.h
diff options
context:
space:
mode:
authorEnochen <darakath1128@gmail.com>2018-07-09 21:12:59 -0400
committerDrashna Jaelre <drashna@live.com>2018-07-09 18:12:59 -0700
commit5477bf39bfc01468ea8c09f025cf9c5ee3efd1b7 (patch)
tree06d8c55b03a5ae89353f137e939a531b39d6d43c /keyboards/hhkb/rn42/battery.h
parenta345458fa9ce98b1e69e6a02dbc611fb5a0fe78d (diff)
add hhkb bluetooth functionality (rn42) (#2693)
* add hhkb bluetooth functionality (rn42) pretty much straight from tmk some minor changes to make things work * hhkb jp personal keymap * Revert "hhkb jp personal keymap" This reverts commit 886713d8bb98572f03110f285706a8140a083892.
Diffstat (limited to 'keyboards/hhkb/rn42/battery.h')
-rw-r--r--keyboards/hhkb/rn42/battery.h35
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 0000000000..180d4dcfaa
--- /dev/null
+++ b/keyboards/hhkb/rn42/battery.h
@@ -0,0 +1,35 @@
+#ifndef POWER_H
+#define POWER_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+typedef enum {
+ FULL_CHARGED,
+ CHARGING,
+ DISCHARGING,
+ LOW_VOLTAGE,
+ UNKNOWN,
+} battery_status_t;
+
+typedef enum {
+ LED_CHARGER = 0,
+ LED_ON,
+ LED_OFF,
+ LED_TOGGLE,
+} battery_led_t;
+
+/* Battery API */
+void battery_init(void);
+void battery_led(battery_led_t val);
+bool battery_charging(void);
+uint16_t battery_voltage(void);
+battery_status_t battery_status(void);
+
+#define BATTERY_VOLTAGE_LOW_LIMIT 3500
+#define BATTERY_VOLTAGE_LOW_RECOVERY 3700
+// ADC offset:16, resolution:5mV
+#define BATTERY_ADC_OFFSET 16
+#define BATTERY_ADC_RESOLUTION 5
+
+#endif