uart_txfree()


Getting free buffer size of the designated UART port

Description

int uart_txfree(int $uart_id)

Parameters

$uart_id: UART ID

Return Value

On success, it returns free TX buffer length of the UART, otherwise 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