1
0

Implement battery level interface (#24666)

Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
Joel Challis
2025-02-28 05:46:14 +00:00
committed by GitHub
parent 312f42945d
commit 6ee806f376
12 changed files with 275 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
// Copyright 2024 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define BATTERY_PIN ADC_PIN

View File

@@ -0,0 +1,28 @@
// Copyright 2024 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "battery.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT_ortho_1x1(KC_A)
};
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
debug_enable=true;
// debug_matrix=false;
// debug_keyboard=true;
// debug_mouse=false;
battery_init();
}
void housekeeping_task_user(void) {
static uint32_t last = 0;
if (timer_elapsed32(last) > 2000) {
uprintf("Bat: %d!\n", battery_get_percent());
last = timer_read32();
}
}

View File

@@ -0,0 +1,7 @@
{
"config": {
"features": {
"console": true
}
}
}

View File

@@ -0,0 +1 @@
BATTERY_DRIVER_REQUIRED = yes