Modifying Cory Fowler's CAN bus MCP2515 library for use at slow data rates

johnfarrugia:
I seem to be having some issues with the transmit function as well. So I created A receive and Transmit FIFO in my program. However, I am looking for a way to determine that a transmit buffer is available before sending a message just so i can do other things in my code without having to wait for a buffer to become available.
Any one know how I can do this?

something like this maybe (snippet below)

  digitalWrite(CS, LOW);
	  
  SPI.transfer(0xA0); //SPI_READ_STATUS command
  
  uint8_t r_status = SPI.transfer(0xff);
	  
  digitalWrite(CS, HIGH);
  
  /* Statusbyte:
   *
   * Bit  Function
   *  2 TXB0CNTRL.TXREQ
   *  4 TXB1CNTRL.TXREQ
   *  6 TXB2CNTRL.TXREQ
   */
  
  if (!(r_status & (1<<2))) {
    addr = 0x00;
  }
  else if (!(r_status & (1<<4))) {
    addr = 0x02;
  } 
  else if (!(r_status & (1<<6))) {
    addr = 0x04;
  }
  else {
    // all transmit buffer used => could not send message
    return 0;
  }