MCP_CAN_lib icon indicating copy to clipboard operation
MCP_CAN_lib copied to clipboard

function to reset overflow error bits

Open jesseklm opened this issue 1 year ago • 0 comments

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
}

jesseklm avatar Feb 18 '25 23:02 jesseklm