Skip to content

Commit

Permalink
Don't generate identifiers for SVD outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Oct 16, 2023
1 parent fb750a5 commit 7db4614
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ifgen/data/schemas/Enum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ properties:
type: boolean
default: true

identifier:
type: boolean
default: true

underlying:
type: string
default: uint8_t
Expand Down
4 changes: 4 additions & 0 deletions ifgen/data/schemas/Struct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ properties:
type: boolean
default: true

identifier:
type: boolean
default: true

instances:
type: array
items:
Expand Down
5 changes: 4 additions & 1 deletion ifgen/enum/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,17 @@ def enum_header(task: GenerateTask, writer: IndentedFileWriter) -> None:

runtime = task.enum()

with writer.padding():
writer.empty()

if task.instance["identifier"]:
writer.write(
(
"static constexpr "
f"{task.env.config.data['enum_id_underlying']} "
f"{task.name}_id = {runtime.id};"
)
)
writer.empty()

enum_to_string_function(
task, writer, task.instance["use_map"], definition=True
Expand Down
15 changes: 8 additions & 7 deletions ifgen/struct/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,15 @@ def create_struct(task: GenerateTask) -> None:
with writer.trailing_comment_lines(
style=CommentStyle.C_DOXYGEN
) as lines:
lines.append(
(
"static constexpr "
f"{task.env.config.data['struct_id_underlying']} "
f"id = {task.protocol().id};",
f"{task.name}'s identifier.",
if task.instance["identifier"]:
lines.append(
(
"static constexpr "
f"{task.env.config.data['struct_id_underlying']} "
f"id = {task.protocol().id};",
f"{task.name}'s identifier.",
)
)
)

size = task.env.size(task.name)
enforce_expected_size(size, task.instance, task.name)
Expand Down
2 changes: 2 additions & 0 deletions ifgen/svd/group/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"codec": False,
"methods": False,
"unit_test": False,
"identifier": False,
}


Expand Down Expand Up @@ -148,6 +149,7 @@ def translate_enums(enum: EnumeratedValues) -> dict[str, Any]:
"unit_test": False,
"json": False,
"use_map": False,
"identifier": False,
}


Expand Down

0 comments on commit 7db4614

Please sign in to comment.