AVR8 signature extraction and validation (from TDFs)

This commit is contained in:
Nav
2021-06-07 00:15:25 +01:00
parent a65cc0b5c0
commit b9d286eb43
2 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace Bloom\BuildScripts\TargetDescriptionFiles\Avr8;
class Signature
{
public ?int $byteZero = null;
public ?int $byteOne = null;
public ?int $byteTwo = null;
public function toHex(): string
{
if (is_null($this->byteZero) || is_null($this->byteOne) || is_null($this->byteTwo)) {
throw new \Exception("Cannot generate hex string of incomplete AVR8 target signature.");
}
return '0x' . substr('0' . dechex($this->byteZero), -2)
. substr('0' . dechex($this->byteOne), -2)
. substr('0' . dechex($this->byteTwo), -2)
;
}
}