aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/info.py
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-01-08 00:00:15 -0800
committerZach White <skullydazed@drpepper.org>2021-01-08 08:40:23 -0800
commit30331b383f9ef4620e47aa07e4f9af7fae9d30b3 (patch)
tree4d1a12b52d99aa3c31f6a859c9a71959159d58de /lib/python/qmk/info.py
parenta828a82d59b6205a56f7d42d51217f13ffbcb0d5 (diff)
downloadqmk_firmware-30331b383f9ef4620e47aa07e4f9af7fae9d30b3.tar.gz
qmk_firmware-30331b383f9ef4620e47aa07e4f9af7fae9d30b3.zip
fix bugs triggered by certain boards
Diffstat (limited to 'lib/python/qmk/info.py')
-rw-r--r--lib/python/qmk/info.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index efd339115..28c281a4b 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -315,11 +315,10 @@ def _extract_rgblight(info_data, config_c):
315 cli.log.error('%s: config.h: Could not convert "%s" to %s: %s', info_data['keyboard_folder'], config_c[config_key], config_type.__name__, e) 315 cli.log.error('%s: config.h: Could not convert "%s" to %s: %s', info_data['keyboard_folder'], config_c[config_key], config_type.__name__, e)
316 316
317 for json_key, config_key in rgblight_toggles.items(): 317 for json_key, config_key in rgblight_toggles.items():
318 if config_key in config_c: 318 if config_key in config_c and json_key in rgblight:
319 if json_key in rgblight: 319 _log_warning(info_data, 'RGB Light: %s is specified in both info.json and config.h, the config.h value wins.', json_key)
320 _log_warning(info_data, 'RGB Light: %s is specified in both info.json and config.h, the config.h value wins.', json_key)
321 320
322 rgblight[json_key] = config_c[config_key] 321 rgblight[json_key] = config_key in config_c
323 322
324 for json_key, config_key in rgblight_animations.items(): 323 for json_key, config_key in rgblight_animations.items():
325 if config_key in config_c: 324 if config_key in config_c:
@@ -337,16 +336,30 @@ def _extract_rgblight(info_data, config_c):
337 return info_data 336 return info_data
338 337
339 338
340def _extract_pins(pins): 339def _pin_name(pin):
341 """Returns a list of pins from a comma separated string of pins. 340 """Returns the proper representation for a pin.
342 """ 341 """
343 pins = [pin.strip() for pin in pins.split(',') if pin] 342 pin = pin.strip()
343
344 if not pin:
345 return None
346
347 elif pin.isdigit():
348 return int(pin)
344 349
345 for pin in pins: 350 elif pin == 'NO_PIN':
346 if pin[0] not in 'ABCDEFGHIJK' or not pin[1].isdigit(): 351 return None
347 raise ValueError(f'Invalid pin: {pin}')
348 352
349 return pins 353 elif pin[0] in 'ABCDEFGHIJK' and pin[1].isdigit():
354 return pin
355
356 raise ValueError(f'Invalid pin: {pin}')
357
358
359def _extract_pins(pins):
360 """Returns a list of pins from a comma separated string of pins.
361 """
362 return [_pin_name(pin) for pin in pins.split(',')]
350 363
351 364
352def _extract_direct_matrix(info_data, direct_pins): 365def _extract_direct_matrix(info_data, direct_pins):