2021-06-07 00:15:25 +01:00
|
|
|
<?php
|
2024-02-09 23:30:47 +00:00
|
|
|
namespace Targets\TargetDescriptionFiles\Avr8;
|
2021-06-07 00:15:25 +01:00
|
|
|
|
|
|
|
|
class Signature
|
|
|
|
|
{
|
|
|
|
|
public ?int $byteZero = null;
|
|
|
|
|
public ?int $byteOne = null;
|
|
|
|
|
public ?int $byteTwo = null;
|
|
|
|
|
|
|
|
|
|
public function toHex(): string
|
|
|
|
|
{
|
2024-02-09 23:30:47 +00:00
|
|
|
if ($this->byteZero === null || $this->byteOne === null || $this->byteTwo === null) {
|
2021-06-07 00:15:25 +01:00
|
|
|
throw new \Exception("Cannot generate hex string of incomplete AVR8 target signature.");
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-07 17:50:43 +01:00
|
|
|
return '0x' . strtoupper(
|
|
|
|
|
substr('0' . dechex($this->byteZero), -2)
|
2021-06-07 00:15:25 +01:00
|
|
|
. substr('0' . dechex($this->byteOne), -2)
|
|
|
|
|
. substr('0' . dechex($this->byteTwo), -2)
|
2024-07-07 17:50:43 +01:00
|
|
|
);
|
2021-06-07 00:15:25 +01:00
|
|
|
}
|
|
|
|
|
}
|