Ok i will check it out.johu wrote: ↑Thu Oct 14, 2021 8:47 am Yes, I believe that's what I've done. You can check out the latest code here: https://github.com/damienmaguire/Stm32- ... t-refactor
Now that we are at it i have some small request which i think you agree/like.
In stm32_can.cpp i added:
Code: Select all
/** \brief Send a user defined CAN message
*
* \param SENDBUFFER *data
* \return void
*
*/
void Can::Send(SENDBUFFER *canmsg)
{
//copy to the local stack...
uint32_t canId=canmsg->id;
uint32_t data[2];
uint8_t len=canmsg->len;
data[0]= canmsg->data[0];
data[1]= canmsg->data[1];
can_disable_irq(canDev, CAN_IER_TMEIE);
if (can_transmit(canDev, canId, false, false, len, (uint8_t*)data) < 0 && sendCnt < SENDBUFFER_LEN)
{
/* enqueue in send buffer if all TX mailboxes are full */
sendBuffer[sendCnt].id = canId;
sendBuffer[sendCnt].len = len;
sendBuffer[sendCnt].data[0] = data[0];
sendBuffer[sendCnt].data[1] = data[1];
sendCnt++;
}
if (sendCnt > 0)
{
can_enable_irq(canDev, CAN_IER_TMEIE);
}
}
Now you can easyly dump a item to the canbus.
but also move around pointers or start new canbus items within the application and ditch the data[2] way of doing it...(sorry who started that)..
Now for my project i want to make an extension like
Code: Select all
struct CANMSG
{
SENDBUFFER msg; //this one can be sended out to the bus...
//lets drag allong some more information...
uint8_t crcpresent;
uint8_t crcbyte;
uint8_t crcpoly;
uint8_t crcoffset;
uint8_t counterbyte;
};