PR feedback

This commit is contained in:
Ken Van Hoeylandt 2026-02-08 23:13:22 +01:00
parent daf35b53ab
commit ded3b6f2c3
4 changed files with 8 additions and 9 deletions

View File

@ -1,3 +1,2 @@
class DevicetreeException(Exception):
def __init__(self, message):
super().__init__(message)
pass

View File

@ -61,9 +61,7 @@ def find_phandle(devices: list[Device], phandle: str):
def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
type = property.type
if type == "value":
return property.value
elif type == "int":
if type == "value" or type == "int":
return property.value
elif type == "boolean":
return "true"

View File

@ -14,7 +14,8 @@ from source.exception import DevicetreeException
def main(config_path: str, output_path: str, verbose: bool) -> int:
print(f"Generating devicetree code\n config: {config_path}\n output: {output_path}")
if not os.path.isdir(config_path):
raise DevicetreeException(f"Directory not found: {config_path}")
print(f"Directory not found: {config_path}")
return 1
config = parse_config(config_path, os.getcwd())
if verbose:
@ -34,11 +35,11 @@ def main(config_path: str, output_path: str, verbose: bool) -> int:
pprint(transformed)
binding_files = find_all_bindings(config.bindings)
if verbose:
print(f"Bindings found:")
print("Bindings found:")
for binding_file in binding_files:
print(f" {binding_file}")
if verbose:
print(f"Parsing bindings")
print("Parsing bindings")
bindings = []
for binding_file in binding_files:
bindings.append(parse_binding(binding_file, config.bindings))

View File

@ -21,10 +21,11 @@ properties:
description: WS pin
pin-data-out:
type: int
default: GPIO_PIN_NONE
description: DATA OUT pin
pin-data-in:
type: int
required: false
default: GPIO_PIN_NONE
description: DATA IN pin
pin-mclk:
type: int