From a03c54150eea31d1f99cdca549b9bc2147c4f5f1 Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 11 Aug 2024 17:02:21 +0100 Subject: [PATCH] New TDF rule added to TDF validation: All TDFs must have at least one Insight-compatible pinout. --- .../Services/ValidationService.php | 3 +++ .../TargetDescriptionFile.php | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php b/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php index e0e744f9..cd7a2450 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php @@ -121,6 +121,9 @@ class ValidationService if (empty($tdf->pinouts)) { $failures[] = 'Missing pinouts'; + + } elseif (empty($tdf->getInsightCompatiblePinouts())) { + $failures[] = 'No Insight-compatible pinouts'; } $processedPinoutKeys = []; diff --git a/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php b/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php index e27d7b3b..9713df03 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php +++ b/build/scripts/Targets/TargetDescriptionFiles/TargetDescriptionFile.php @@ -247,6 +247,28 @@ class TargetDescriptionFile return null; } + /** + * Returns all pinouts that are supported by the target package widget, in Bloom's Insight GUI. + * + * @return array + */ + public function getInsightCompatiblePinouts(): array + { + return array_filter( + $this->pinouts, + fn (Pinout $pinout): bool => in_array( + $pinout->type, + [ + PinoutType::DIP, + PinoutType::QFP, + PinoutType::QFN, + PinoutType::SOIC, + PinoutType::SSOP, + ] + ) + ); + } + public function getTargetPeripheral(string $peripheralKey): ?TargetPeripheral { $peripheral = $this->getPeripheral($peripheralKey);