We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c1ade2 commit 37e4969Copy full SHA for 37e4969
src/MCP2515.cpp
@@ -187,15 +187,24 @@ int MCP2515Class::endPacket()
187
188
writeRegister(REG_TXBnCTRL(n), 0x08);
189
190
+ bool aborted = false;
191
+
192
while (readRegister(REG_TXBnCTRL(n)) & 0x08) {
193
if (readRegister(REG_TXBnCTRL(n)) & 0x10) {
194
// abort
195
+ aborted = true;
196
197
modifyRegister(REG_CANCTRL, 0x10, 0x10);
198
}
199
200
yield();
201
202
203
+ if (aborted) {
204
+ // clear abort command
205
+ modifyRegister(REG_CANCTRL, 0x10, 0x00);
206
+ }
207
208
modifyRegister(REG_CANINTF, FLAG_TXnIF(n), 0x00);
209
210
return (readRegister(REG_TXBnCTRL(n)) & 0x70) ? 0 : 1;
0 commit comments