Description

transmitBufferFull() – returns true if the tx buffer of the CAN bus is full.

Syntax

if( MCAN0.transmitBufferFull() )

Parameters

none

Returns

bool:
true – TX buffer can not take any more CAN messages.
false – there is space for at least one more CAN message in the send buffer.

Example Code

The following example initialises the second CAN bus MCAN1 (e.g. on a dice-2CAN device) with 1 MBaud and sends messages with extended ID if the there is space in the tx buffer.

void setup()
{  
  MCAN1.begin(1000 * 1000);
  MCAN1.setMode(MCP_NORMAL);
}

void loop () 
{
  CANMessage myMsg;
  myMsg.id = 0x12345;
  myMsg.ext = true;
  myMsg.len = 1;
  myMsg.data[0] = 0xA5;
  if( ! MCAN1.transmitBufferFull() )
    MCAN1.sendMsgBuf(myMsg);
  delay(300);
}

Notes and Warnings

Examples can be found in the Arduino IDE menu:
File -> Examples -> DICE -> CAN Bus ->

See also

Find more details about the ‘bootloader settings’ and the CAN bus of dice devices
begin()
defines
CAN operation background
users manual
BOOTLOADER SETTINGS – Library