Getting free buffer size of the designated UART port
int uart_txfree(int $uart_id)
$uart_id: UART ID
On success, it returns free TX buffer length of the UART, otherwise 0
<?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
?>