stm32plus icon indicating copy to clipboard operation
stm32plus copied to clipboard

Improvements for CAN error handling

Open martin31821 opened this issue 7 years ago • 0 comments

For a project of mine, I needed more error handling and management when using the CAN bus, this is more a proposal than a bug.

CAN in the STM32 series is structured with mailboxes which are essential when sending CAN messages. My proposal is to change the following methods:

/* change */ uint8_t Can::send(...);
//to return the mailbox used or CAN_TxStatus_NoMailBox if all mailboxes are in use


/* add */ bool Can::transmittionPending(uint8_t mbox);
//to check if the transmission is pending in the given mailbox


/* add */ bool Can::hasErrors();
//to check if errors occured during the last transmissions 
//this method should set the ErrorCode in the errorProvider, so it can be tracked down.

Please also note that this proposal breaks the current Can API. An implementation can be seen in my fork

martin31821 avatar Nov 07 '16 19:11 martin31821