Refactor battery driver (#25550)

This commit is contained in:
Joel Challis 2025-08-17 01:14:48 +01:00 committed by GitHub
parent f29d8117bf
commit cc696a2ae8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 287 additions and 73 deletions

View file

@ -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"},

View file

@ -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},

View file

@ -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,