diff options
| author | Joel Challis | 2025-08-17 02:14:48 +0200 |
|---|---|---|
| committer | GitHub | 2025-08-17 02:14:48 +0200 |
| commit | cc696a2ae838a9639335ca8eb3cb3b794c06bc33 (patch) | |
| tree | 901b54bda536acb5503c6cf924b0f30bca1a174e /docs/features | |
| parent | f29d8117bf877a4df1f88f40e0131f4465748540 (diff) | |
Refactor battery driver (#25550)
Diffstat (limited to 'docs/features')
| -rw-r--r-- | docs/features/battery.md | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/docs/features/battery.md b/docs/features/battery.md new file mode 100644 index 0000000000..f5c725efb9 --- /dev/null +++ b/docs/features/battery.md @@ -0,0 +1,55 @@ +# Battery + +This feature provides the high level abstraction for sampling battery level. + +## Usage + +To use this driver, add the following to your `rules.mk`: + +```make +BATTERY_ENABLE = yes +``` + +## Basic Configuration {#basic-configuration} + +Add the following to your `config.h`: + +|Define |Default |Description | +|--------------------------|--------|--------------------------------------------------| +|`BATTERY_SAMPLE_INTERVAL` |`30000` |The time between battery samples in milliseconds. | + +## Driver Configuration {#driver-configuration} + +See the [Battery Driver](../drivers/battery) documentation for more information. + +## Functions + +### `uint8_t battery_get_percent(void)` {#api-battery-get-percent} + +Sample battery level. + +#### Return Value {#api-battery-get-percent-return} + +The battery percentage, in the range 0-100. + +## Callbacks + +### `void battery_percent_changed_user(uint8_t level)` {#api-battery-percent-changed-user} + +User hook called when battery level changed. + +### Arguments {#api-battery-percent-changed-user-arguments} + + - `uint8_t level` + The battery percentage, in the range 0-100. + +--- + +### `void battery_percent_changed_kb(uint8_t level)` {#api-battery-percent-changed-kb} + +Keyboard hook called when battery level changed. + +### Arguments {#api-battery-percent-changed-kb-arguments} + + - `uint8_t level` + The battery percentage, in the range 0-100. |