New TDF rule added to TDF validation: All TDFs must have at least one Insight-compatible pinout.

This commit is contained in:
Nav
2024-08-11 17:02:21 +01:00
parent f3e2a5c8a5
commit a03c54150e
2 changed files with 25 additions and 0 deletions

View File

@@ -121,6 +121,9 @@ class ValidationService
if (empty($tdf->pinouts)) { if (empty($tdf->pinouts)) {
$failures[] = 'Missing pinouts'; $failures[] = 'Missing pinouts';
} elseif (empty($tdf->getInsightCompatiblePinouts())) {
$failures[] = 'No Insight-compatible pinouts';
} }
$processedPinoutKeys = []; $processedPinoutKeys = [];

View File

@@ -247,6 +247,28 @@ class TargetDescriptionFile
return null; 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 public function getTargetPeripheral(string $peripheralKey): ?TargetPeripheral
{ {
$peripheral = $this->getPeripheral($peripheralKey); $peripheral = $this->getPeripheral($peripheralKey);