This commit is contained in:
Zach White 2021-09-05 10:54:33 -07:00
parent 0b1dee6c50
commit c13ce5479c
4 changed files with 89 additions and 1 deletions

View file

@ -7,6 +7,7 @@
# to_json: Default `true`. Set to `false` to exclude this mapping from info.json # 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 # 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 # 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"}, "AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"},
"BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"}, "BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"},
"BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"}, "BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"},

View file

@ -19,7 +19,75 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "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"}, "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"} "voices": {"type": "boolean"}
} }
}, },

View file

@ -12,6 +12,25 @@ from qmk.keymap import locate_keymap
from qmk.path import normpath 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): def direct_pins(direct_pins, postfix):
"""Return the config.h lines that set the direct pins. """Return the config.h lines that set the direct pins.
""" """

View file

@ -193,7 +193,7 @@ def _extract_audio(info_data, config_c):
audio_pins = [] audio_pins = []
for pin in 'B5', 'B6', 'B7', 'C4', 'C5', 'C6': 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) audio_pins.append(pin)
if audio_pins: if audio_pins: