Skip to content

Commit d99fc7e

Browse files
authored
Merge pull request autowp#64 from designer2k2/master
Add functions to expose the RX/TX error counters
2 parents cdc0141 + d7ac8f6 commit d99fc7e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

mcp2515.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,3 +754,13 @@ void MCP2515::clearERRIF()
754754
//clearInterrupts();
755755
modifyRegister(MCP_CANINTF, CANINTF_ERRIF, 0);
756756
}
757+
758+
uint8_t MCP2515::errorCountRX(void)
759+
{
760+
return readRegister(MCP_REC);
761+
}
762+
763+
uint8_t MCP2515::errorCountTX(void)
764+
{
765+
return readRegister(MCP_TEC);
766+
}

mcp2515.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ class MCP2515
488488
void clearRXnOVR(void);
489489
void clearMERR();
490490
void clearERRIF();
491+
uint8_t errorCountRX(void);
492+
uint8_t errorCountTX(void);
491493
};
492494

493495
#endif

0 commit comments

Comments
 (0)