Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2022 23:32
What would you like to do?
PHP script to accompany esp32_spirecovery.ino
use lepiaf\SerialPort\SerialPort;
use lepiaf\SerialPort\Parser\SeparatorParser;
use lepiaf\SerialPort\Configure\TTYConfigure;
$bios = fopen("bios.bin", "r");
$configure = new TTYConfigure();
$block = 0;
$serialPort = new SerialPort(new SeparatorParser(), $configure);
while (true)
$data = $serialPort->read();
echo $data."\n";
if ($data === "W") {
echo "write block " . $block . "\n";
$data = fread($bios, 4096);
if ($data === false)
echo "done!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment