Updated AtdfService to clear any peripheral register group key and name attributes, where necessary.

This commit is contained in:
Nav
2024-08-13 22:42:24 +01:00
parent 8ba29c258d
commit 129e54dd2d

View File

@@ -640,6 +640,24 @@ class AtdfService
} }
} }
if (count($output->registerGroupInstances) === 1) {
/*
* ATDF peripherals sometimes override the register group keys and names, when there's only a single
* register group in the peripheral.
*
* This is not necessary for Bloom's TDFs, so we tidy it up here by clearing the `key` and `name`
* attributes where we can.
*/
foreach ($output->registerGroupInstances as $instance) {
if ($output->key == 'fuse' && $instance->key !== $instance->registerGroupKey) {
continue;
}
$instance->key = null;
$instance->name = null;
}
}
$signalElement = $element->getElementsByTagName('signals')->item(0); $signalElement = $element->getElementsByTagName('signals')->item(0);
if ($signalElement instanceof DOMElement) { if ($signalElement instanceof DOMElement) {
foreach ($signalElement->childNodes as $childNode) { foreach ($signalElement->childNodes as $childNode) {