MCP_CAN_lib
MCP_CAN_lib copied to clipboard
function to reset overflow error bits
This PR adds a new function, resetOverflowErrors(). It resets the overflow error bits (MCP_EFLG_RX0OVR and MCP_EFLG_RX1OVR) in the MCP_EFLG register, ensuring that these flags can be cleared after an overflow event.
Example for overflow checking:
uint8_t eflg = can.getError();
if ((eflg & MCP_EFLG_RX1OVR) || (eflg & MCP_EFLG_RX0OVR)) {
Serial.println("buffer overflow!");
can.resetOverflowErrors(); // new
}