Configuring and Using the designated UIO


int/string uio_ioctl(int $uio_id, string $cmd)


refer to the document named PHPoC Device Programming Guide for P40 for the details about commands available on $cmd

Return Value

return value for the command set


include "/lib/sd_340.php";
uio_ioctl(0, "set 0 mode out");          // setting the pin 0 of the UIO0 to output port
uio_ioctl(0, "set 1-3 mode in");         // setting the pin 1, 2, and 3 of the UIO0 to input ports
$state_0 = uio_ioctl(0, "get 0 output"); // getting the pin 0's state of the UIO0
$state_1 = uio_ioctl(0, "get 1 input");  // getting the pin 1's state of the UIO0
$state_2 = uio_ioctl(0, "get 2 input");  // getting the pin 2's state of the UIO0
$state_3 = uio_ioctl(0, "get 3 input");  // getting the pin 3's state of the UIO0

See also