Files
qmk_firmware/assets/features_battery.md.B6Ab94Jc.js
T

14 lines
4.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { _ as _export_sfc, o as openBlock, c as createElementBlock, al as createStaticVNode } from "./chunks/framework.8zKZLKO7.js";
const __pageData = JSON.parse('{"title":"Battery","description":"","frontmatter":{},"headers":[],"relativePath":"features/battery.md","filePath":"features/battery.md","lastUpdated":null}');
const _sfc_main = { name: "features/battery.md" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, [..._cache[0] || (_cache[0] = [
createStaticVNode('<h1 id="battery" tabindex="-1">Battery <a class="header-anchor" href="#battery" aria-label="Permalink to &quot;Battery&quot;">​</a></h1><p>This feature provides the high level abstraction for sampling battery level.</p><h2 id="usage" tabindex="-1">Usage <a class="header-anchor" href="#usage" aria-label="Permalink to &quot;Usage&quot;">​</a></h2><p>To use this driver, add the following to your <code>rules.mk</code>:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">BATTERY_ENABLE = yes</span></span></code></pre></div><h2 id="basic-configuration" tabindex="-1">Basic Configuration <a class="header-anchor" href="#basic-configuration" aria-label="Permalink to &quot;Basic Configuration {#basic-configuration}&quot;">​</a></h2><p>Add the following to your <code>config.h</code>:</p><table tabindex="0"><thead><tr><th>Define</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>BATTERY_SAMPLE_INTERVAL</code></td><td><code>30000</code></td><td>The time between battery samples in milliseconds.</td></tr></tbody></table><h2 id="driver-configuration" tabindex="-1">Driver Configuration <a class="header-anchor" href="#driver-configuration" aria-label="Permalink to &quot;Driver Configuration {#driver-configuration}&quot;">​</a></h2><p>See the <a href="./../drivers/battery">Battery Driver</a> documentation for more information.</p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;">​</a></h2><h3 id="api-battery-get-percent" tabindex="-1"><code>uint8_t battery_get_percent(void)</code> <a class="header-anchor" href="#api-battery-get-percent" aria-label="Permalink to &quot;`uint8_t battery_get_percent(void)` {#api-battery-get-percent}&quot;">​</a></h3><p>Sample battery level.</p><h4 id="api-battery-get-percent-return" tabindex="-1">Return Value <a class="header-anchor" href="#api-battery-get-percent-return" aria-label="Permalink to &quot;Return Value {#api-battery-get-percent-return}&quot;">​</a></h4><p>The battery percentage, in the range 0-100.</p><h2 id="callbacks" tabindex="-1">Callbacks <a class="header-anchor" href="#callbacks" aria-label="Permalink to &quot;Callbacks&quot;">​</a></h2><h3 id="api-battery-percent-changed-user" tabindex="-1"><code>void battery_percent_changed_user(uint8_t level)</code> <a class="header-anchor" href="#api-battery-percent-changed-user" aria-label="Permalink to &quot;`void battery_percent_changed_user(uint8_t level)` {#api-battery-percent-changed-user}&quot;">​</a></h3><p>User hook called when battery level changed.</p><h3 id="api-battery-percent-changed-user-arguments" tabindex="-1">Arguments <a class="header-anchor" href="#api-battery-percent-changed-user-arguments" aria-label="Permalink to &quot;Arguments {#api-battery-percent-changed-user-arguments}&quot;">​</a></h3><ul><li><code>uint8_t level</code><br> The battery percentage, in the range 0-100.</li></ul><hr><h3 id="api-battery-percent-changed-kb" tabindex="-1"><code>void battery_percent_changed_kb(uint8_t level)</code> <a class="header-anchor" href="#api-battery-percent-changed-kb" aria-label="Permalink to &quot;`void battery_percent_changed_kb(uint8_t level)` {#api-battery-percent-changed-kb}&quot;">​</a></h3><p>Keyboard hook called when battery level changed.</p><h3 id="api-battery-percent-changed-kb-arguments" tabindex="-1">Arguments <a class="header-anchor" href="#api-battery-percent-changed-kb-arguments" aria-label="Permalink to &quot;Arguments {#api-battery-percent-changed-kb-arguments}&quot;">​</a></h3><ul><li><code>uint8_t level</code><br> The battery percentage, in the range 0-100.</li></ul>', 25)
])]);
}
const battery = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
battery as default
};