int pid_close ( int $pid )
pid_close() closes the specified port/peripheral
※ available F/W version : all
Returns 0 on success, PHP error on error
<?php
$pid = pid_open("/mmap/uart0"); // open UART0
$buf = "Hello PHPoC!";
// set the device to 115200bps, no parity, 8 databit, 1stop bit
pid_ioctl($pid, "set baud 115200");
pid_ioctl($pid, "set parity 0");
pid_ioctl($pid, "set data 8");
pid_ioctl($pid, "set stop 1");
pid_ioctl($pid, "set flowctrl 0");
$wlen = pid_write($pid, $buf, 12); // write 12 bytes of the $buf to the $pid
pid_close($pid);
?>
pid_open() / pid_read() / pid_write() / pid_ioctl() / pid_recv() / pid_send()
Even though a pid_close() function has been called, some devices can be accessed without pid_open() function.