From cc696a2ae838a9639335ca8eb3cb3b794c06bc33 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 17 Aug 2025 01:14:48 +0100 Subject: Refactor battery driver (#25550) --- data/mappings/info_config.hjson | 8 ++++++++ data/mappings/info_rules.hjson | 1 + data/schemas/keyboard.jsonschema | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) (limited to 'data') diff --git a/data/mappings/info_config.hjson b/data/mappings/info_config.hjson index a160e490c7..4c53aa4339 100644 --- a/data/mappings/info_config.hjson +++ b/data/mappings/info_config.hjson @@ -43,6 +43,14 @@ "BOOTMAGIC_ROW": {"info_key": "bootmagic.matrix.0", "value_type": "int"}, "BOOTMAGIC_ROW_RIGHT": {"info_key": "split.bootmagic.matrix.0", "value_type": "int"}, + // Battery + "BATTERY_SAMPLE_INTERVAL": {"info_key": "battery.sample_interval", "value_type": "int"}, + "BATTERY_ADC_PIN": {"info_key": "battery.adc.pin"}, + "BATTERY_ADC_REF_VOLTAGE_MV": {"info_key": "battery.adc.reference_voltage", "value_type": "int"}, + "BATTERY_ADC_VOLTAGE_DIVIDER_R1": {"info_key": "battery.adc.divider_r1", "value_type": "int"}, + "BATTERY_ADC_VOLTAGE_DIVIDER_R2": {"info_key": "battery.adc.divider_r2", "value_type": "int"}, + "BATTERY_ADC_RESOLUTION": {"info_key": "battery.adc.resolution", "value_type": "int"}, + // Caps Word "BOTH_SHIFTS_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.both_shifts_turns_on", "value_type": "flag"}, "CAPS_WORD_IDLE_TIMEOUT": {"info_key": "caps_word.idle_timeout", "value_type": "int"}, diff --git a/data/mappings/info_rules.hjson b/data/mappings/info_rules.hjson index d43d83c3ea..5ecd5c12b3 100644 --- a/data/mappings/info_rules.hjson +++ b/data/mappings/info_rules.hjson @@ -13,6 +13,7 @@ "AUDIO_DRIVER": {"info_key": "audio.driver"}, "BACKLIGHT_DRIVER": {"info_key": "backlight.driver"}, + "BATTERY_DRIVER": {"info_key": "battery.driver"}, "BLUETOOTH_DRIVER": {"info_key": "bluetooth.driver"}, "BOARD": {"info_key": "board"}, "BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 3775b66c1a..93b1c82b1c 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -188,6 +188,28 @@ "as_caps_lock": {"type": "boolean"} } }, + "battery": { + "type": "object", + "additionalProperties": false, + "properties": { + "driver": { + "type": "string", + "enum": ["adc", "custom", "vendor"] + }, + "adc": { + "type": "object", + "additionalProperties": false, + "properties": { + "pin": {"$ref": "./definitions.jsonschema#/mcu_pin"}, + "reference_voltage": {"type": "integer"}, + "divider_r1": {"type": "integer"}, + "divider_r2": {"type": "integer"}, + "resolution": {"type": "integer"} + } + }, + "sample_interval": {"type": "integer"} + } + }, "bluetooth": { "type": "object", "additionalProperties": false, -- cgit v1.2.3