//----------------------------------------------------------------------------
//
//
//----------------------------------------------------------------------------


#include <biwak/can.hpp>
#include <biwak/linux/can.hpp>


CCan::CCan( const SCanConfig &_configData, EBitRate bitRate /*=e500kbit*/ )
   :m_configData(_configData)
   //,gpioTx(m_configData.eGpioPeripheralTx, m_configData.eGpioPinTx)
   //,gpioRx(m_configData.eGpioPeripheralRx, m_configData.eGpioPinRx)
   //,m_mailBox(sizeof(SCanMailBox), CAN_MAILBOXES)
   ,m_rxBuffer(CAN_BUFFERS)
   #if ! defined STM32
   ,m_txBuffer( CAN_BUFFERS * 100 )
   #endif
{
   // Just nothing to do
}


CCan::~CCan( )
{
   // Just nothing to do
}


void CCan::deinit()
{
   
}


int CCan::transmit(const SCanMessage& txMsg)
{
   // Push it back to my receive buffer
   m_txBuffer << txMsg;
   return(0);
}


int CCan::transmit(canId_t id, int len, const void *data)
{
   SCanMessage message(id, len, (const uint8_t*)data);
   // Push it back to my receive buffer
   m_txBuffer << message;
   return(0);
}


//----------------------------------------------------------------------------
