diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json index 72bb0f4a1c..b3f6f0b8de 100644 --- a/data/mappings/info_config.json +++ b/data/mappings/info_config.json @@ -7,6 +7,7 @@ # to_json: Default `true`. Set to `false` to exclude this mapping from info.json # to_c: Default `true`. Set to `false` to exclude this mapping from config.h # warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places + "AUDIO_PIN_ALT_AS_NEGATIVE": {"info_key": "audio.alt_as_negative", "value_type": "bool"}, "AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"}, "BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"}, "BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"}, diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 78c9a8d36b..bf9b3ba246 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -19,7 +19,75 @@ "type": "object", "additionalProperties": false, "properties": { + "alt_as_negative": {"type": "boolean"}, + "clicky": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": {"type": "boolean"}, + "frequency": { + "type": "object", + "additionalProperties": false, + "properties": { + "default": {"$ref": "qmk.definitions.v1#/signed_decimal"}, + "factor": {"$ref": "qmk.definitions.v1#/signed_decimal"}, + "max": {"$ref": "qmk.definitions.v1#/signed_decimal"}, + "min": {"$ref": "qmk.definitions.v1#/signed_decimal"}, + "randomness": {"$ref": "qmk.definitions.v1#/signed_decimal"} + } + }, + "delay": {"$ref": "qmk.definitions.v1#/signed_int"} + } + }, + "dac": { + "type": "object", + "additionalProperties": false, + "properties": { + "sample_waveform": { + "default": "sine", + "type": "string", + "enum": ["sine", "square", "trapezoid", "triangle"] + }, + "channel": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + } + }, + "driver": { + "type": "string", + "enum": ["dac_basic", "dac_additive", "pwm_hardware", "pwm_software"], + }, + "init_delay": {"type": "boolean"}, + "music_mode": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": {"type": "boolean"}, + "pitch_standard": {"$ref": "qmk.definitions.v1#/signed_decimal"} + } + }, "pins": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, + "pwm": { + "type": "object", + "additionalProperties": false, + "properties": { + "channel": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "driver": { + "default": "PWMD1", + "type": "string", + "enum": ["PWMD1", "PWMD2", "PWMD3", "PWMD4", "PWMD5"] + }, + "pal_mode": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + } + }, + "sendstring_bell": {"type": "boolean"}, + "tempo": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "tone_multiplexing": { + "type": "object", + "additionalProperties": false, + "properties": { + "default_rate": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "enabled": {"type": "boolean"} + } + }, "voices": {"type": "boolean"} } }, diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index ca7e14fe6b..69ee9fc7e9 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -12,6 +12,25 @@ from qmk.keymap import locate_keymap from qmk.path import normpath +def audio_pins(audio): + """Return the config.h lines to configure audio. + """ + config_h = [] + + if 'pins' in audio: + if len(audio['pins']) > 0: + config_h.append('#ifndef AUDIO_PIN') + config_h.append(f'# define AUDIO_PIN f{audio["pins"][0]}') + config_h.append('#endif // AUDIO_PIN') + + if len(audio['pins']) > 1: + config_h.append('#ifndef AUDIO_PIN_ALT') + config_h.append(f'# define AUDIO_PIN_ALT f{audio["pins"][1]}') + config_h.append('#endif // AUDIO_PIN_ALT') + + return '\n'.join(config_h) + + def direct_pins(direct_pins, postfix): """Return the config.h lines that set the direct pins. """ diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 7f3aabdc3b..7afae34cd1 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -193,7 +193,7 @@ def _extract_audio(info_data, config_c): audio_pins = [] for pin in 'B5', 'B6', 'B7', 'C4', 'C5', 'C6': - if config_c.get(f'{pin}_AUDIO'): + if config_c.get(f'{pin}_AUDIO') or config_c.get(f'{pin}_AUDIO_ALT'): audio_pins.append(pin) if audio_pins: