digistump/DigisparkArduinoIntegration — pull request #2 by percentcer (2013-01-20 22:44:15+00:00)
Title: Adding tx_remaining method

I found this code to be helpful, it's in response to Bluebie's post on the digistump discussion boards (http://digistump.com/board/index.php?p=/discussion/108/wish-digiusb-update-with-blocking-io-option-buffer-size-adjustment-tx-buffer-remaining-bytes).

Used to avoid overloading the tx buffer, this will let you check ahead of time if there's enough room to do a DigiUSB.write(). For example:

```C
if ( DigiUSB.tx_remaining() > sizeof("data I'm sending" ) {
DigiUSB.write("data I'm sending");
}
```