aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/battery/battery.h
diff options
context:
space:
mode:
authorJoel Challis2025-08-17 02:14:48 +0200
committerGitHub2025-08-17 02:14:48 +0200
commitcc696a2ae838a9639335ca8eb3cb3b794c06bc33 (patch)
tree901b54bda536acb5503c6cf924b0f30bca1a174e /quantum/battery/battery.h
parentf29d8117bf877a4df1f88f40e0131f4465748540 (diff)
Refactor battery driver (#25550)
Diffstat (limited to 'quantum/battery/battery.h')
-rw-r--r--quantum/battery/battery.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/quantum/battery/battery.h b/quantum/battery/battery.h
new file mode 100644
index 0000000000..0985723eaa
--- /dev/null
+++ b/quantum/battery/battery.h
@@ -0,0 +1,46 @@
+// Copyright 2025 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+
+/**
+ * \file
+ *
+ * \defgroup battery Battery API
+ *
+ * \brief API to query battery status.
+ * \{
+ */
+
+/**
+ * \brief Initialize the battery driver.
+ */
+void battery_init(void);
+
+/**
+ * \brief Perform housekeeping tasks.
+ */
+void battery_task(void);
+
+/**
+ * \brief Sample battery level.
+ *
+ * \return The battery percentage, in the range 0-100.
+ */
+uint8_t battery_get_percent(void);
+
+/**
+ * \brief user hook called when battery level changed.
+ *
+ */
+void battery_percent_changed_user(uint8_t level);
+
+/**
+ * \brief keyboard hook called when battery level changed.
+ *
+ */
+void battery_percent_changed_kb(uint8_t level);
+
+/** \} */