diff options
Diffstat (limited to 'lib/python')
-rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 6 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/develop_pr_list.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/constants.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/info.py | 28 |
4 files changed, 30 insertions, 8 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index f16dca1de8..6b1012fae7 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -108,6 +108,12 @@ def generate_config_items(kb_info_json, config_h_lines): config_h_lines.append(f'#ifndef {key}') config_h_lines.append(f'# define {key} {value}') config_h_lines.append(f'#endif // {key}') + elif key_type == 'bcd_version': + (major, minor, revision) = config_value.split('.') + config_h_lines.append('') + config_h_lines.append(f'#ifndef {config_key}') + config_h_lines.append(f'# define {config_key} 0x{major.zfill(2)}{minor}{revision}') + config_h_lines.append(f'#endif // {config_key}') else: config_h_lines.append('') config_h_lines.append(f'#ifndef {config_key}') diff --git a/lib/python/qmk/cli/generate/develop_pr_list.py b/lib/python/qmk/cli/generate/develop_pr_list.py index 07e46752a6..fab0262773 100755 --- a/lib/python/qmk/cli/generate/develop_pr_list.py +++ b/lib/python/qmk/cli/generate/develop_pr_list.py @@ -97,7 +97,7 @@ def generate_develop_pr_list(cli): match = git_expr.search(line) if match: pr_info = _get_pr_info(cache, gh, match.group("pr")) - commit_info = {'hash': match.group("hash"), 'title': match.group("title"), 'pr_num': int(match.group("pr")), 'pr_labels': [label.name for label in pr_info.labels.items]} + commit_info = {'hash': match.group("hash"), 'title': pr_info['title'], 'pr_num': int(match.group("pr")), 'pr_labels': [label.name for label in pr_info.labels.items]} _categorise_commit(commit_info) def _dump_commit_list(name, collection): diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py index 433b110523..00e453189f 100644 --- a/lib/python/qmk/constants.py +++ b/lib/python/qmk/constants.py @@ -13,7 +13,7 @@ QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware' MAX_KEYBOARD_SUBFOLDERS = 5 # Supported processor types -CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443', 'GD32VF103', 'WB32F3G71' +CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71' LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85' diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 9a07fc842f..905f10ecc2 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -387,6 +387,19 @@ def _extract_matrix_info(info_data, config_c): return info_data +# TODO: kill off usb.device_ver in favor of usb.device_version +def _extract_device_version(info_data): + if info_data.get('usb'): + if info_data['usb'].get('device_version') and not info_data['usb'].get('device_ver'): + (major, minor, revision) = info_data['usb']['device_version'].split('.', 3) + info_data['usb']['device_ver'] = f'0x{major.zfill(2)}{minor}{revision}' + if not info_data['usb'].get('device_version') and info_data['usb'].get('device_ver'): + major = int(info_data['usb']['device_ver'][2:4]) + minor = int(info_data['usb']['device_ver'][4]) + revision = int(info_data['usb']['device_ver'][5]) + info_data['usb']['device_version'] = f'{major}.{minor}.{revision}' + + def _extract_config_h(info_data): """Pull some keyboard information from existing config.h files """ @@ -430,6 +443,13 @@ def _extract_config_h(info_data): elif key_type == 'int': dotty_info[info_key] = int(config_c[config_key]) + elif key_type == 'bcd_version': + major = int(config_c[config_key][2:4]) + minor = int(config_c[config_key][4]) + revision = int(config_c[config_key][5]) + + dotty_info[info_key] = f'{major}.{minor}.{revision}' + else: dotty_info[info_key] = config_c[config_key] @@ -444,6 +464,7 @@ def _extract_config_h(info_data): _extract_split_main(info_data, config_c) _extract_split_transport(info_data, config_c) _extract_split_right_pins(info_data, config_c) + _extract_device_version(info_data) return info_data @@ -622,12 +643,7 @@ def arm_processor_rules(info_data, rules): info_data['protocol'] = 'ChibiOS' if 'bootloader' not in info_data: - if 'STM32' in info_data['processor']: - info_data['bootloader'] = 'stm32-dfu' - elif 'WB32' in info_data['processor']: - info_data['bootloader'] = 'wb32-dfu' - else: - info_data['bootloader'] = 'unknown' + info_data['bootloader'] = 'unknown' if 'STM32' in info_data['processor']: info_data['platform'] = 'STM32' |