Made key and name attributes optional in register-group-instance TDF elements

Also removed the attribute from all instances of the element, where it wasn't necessary.
This commit is contained in:
Nav
2024-08-13 19:54:05 +01:00
parent 7cf5afde2d
commit f1c82ecd28
265 changed files with 8717 additions and 8742 deletions

View File

@@ -317,12 +317,12 @@ class TargetDescriptionFile
$registerGroup = $this->resolveRegisterGroupInstance($registerGroupInstance, $peripheral->moduleKey);
if ($registerGroup instanceof RegisterGroup) {
$output->registerGroups[] = $this->targetRegisterGroupFromRegisterGroup(
$registerGroupInstance->key,
$registerGroupInstance->name,
$registerGroupInstance->addressSpaceKey,
$registerGroup,
$registerGroupInstance->offset ?? 0,
$peripheral->moduleKey
$peripheral->moduleKey,
$registerGroupInstance->key,
$registerGroupInstance->name
);
}
}
@@ -331,20 +331,25 @@ class TargetDescriptionFile
}
private function targetRegisterGroupFromRegisterGroup(
string $key,
string $name,
string $addressSpaceKey,
RegisterGroup $registerGroup,
int $addressOffset,
string $moduleKey
string $moduleKey,
?string $keyOverride = null,
?string $nameOverride = null
): TargetRegisterGroup {
$addressOffset += $registerGroup->offset ?? 0;
$output = new TargetRegisterGroup($key, $name, $addressSpaceKey, $addressOffset, [], []);
$output = new TargetRegisterGroup(
$keyOverride ?? $registerGroup->key,
$nameOverride ?? $registerGroup->name,
$addressSpaceKey,
$addressOffset,
[],
[]
);
foreach ($registerGroup->subgroups as $subgroup) {
$output->subgroups[] = $this->targetRegisterGroupFromRegisterGroup(
$subgroup->key,
$subgroup->name,
$addressSpaceKey,
$subgroup,
$addressOffset,
@@ -357,12 +362,12 @@ class TargetDescriptionFile
if ($subgroup instanceof RegisterGroup) {
$output->subgroups[] = $this->targetRegisterGroupFromRegisterGroup(
$subgroupReference->key,
$subgroupReference->name,
$addressSpaceKey,
$subgroup,
$addressOffset + $subgroupReference->offset,
$moduleKey
$moduleKey,
$subgroupReference->key,
$subgroupReference->name
);
}
}