Ok so i've got an array with integers (converted from intel Hex file), and need to output it as binary.
Here is the file reader, but how do i convert the array back to a byte stream (utf-8)?
$filename = "./latest/firmware.hex";
$file = fopen($filename, "r");
$image = array();
$imagesize = 0;
$count = 0;
$address = 0;
$type = 0;
while(!feof($file))
{
$line = fgets($file);
$count = intval(substr($line,1,2));
$address = intval(substr($line,3,4));
$type = intval(substr($line,7,2));
if($type==0)
{
for ($i=0; $i < $count; $i++) {
$image[$address+1] = intval(substr($line,9+$i*2,2));
if (($address + $i) > $imagesize)
{
$imagesize = $address + $i;
}
}
}
else if($type == 1)
{
break;
}
}