uart_txfree()


获取指定UART的发送缓冲空间

Description

int uart_txfree(int $uart_id)

Parameters

$uart_id: 确认缓冲区多余空间的UART ID

Return Value

成功时发送缓冲区多余空间(字节 数),失败时0

Example

<?php
include "/lib/sd_340.php";
$wbuf = "abcde";
uart_setup(0, 9600);        // Configuring UART0 to 9600 bps
$tx_free = uart_txfree(0);  // Getting free TX buffer space
if($tx_free >= 5)           // If free TX space is equal to 5 or larger than 5
  uart_write(0, $wbuf);     // Sending the 5 bytes of data
?>

See also