spi_write()


向SPI传送数据

Description

int spi_write(int $spi_id, int/string $wbuf[, int $wlen = MAX_STRING_LEN])

Parameters

Return Value

成功时读取数据长度(byte),失败时0

Example

<?php
include "/lib/sd_340.php";
$wbuf = "\x1E\x07";
spi_setup(0);                   // configuring SPI
$slen = spi_write(0, $wbuf, 2); // transmitting data to the SPI
if($slen == 2)
  echo "$slen bytes has been sent\r\n";
?>

See also