Skip to content

Commit 6c2941c

Browse files
arduinoenigmaautowp
authored andcommitted
feat: refactored One Shot Mode functionality
1 parent ad22d13 commit 6c2941c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=autowp-mcp2515
2-
version=1.2.1
2+
version=1.3.0
33
author=autowp <[email protected]>
44
maintainer=autowp <[email protected]>
55
sentence=Arduino MCP2515 CAN interface library

mcp2515.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,14 @@ MCP2515::ERROR MCP2515::setNormalMode()
177177
return setMode(CANCTRL_REQOP_NORMAL);
178178
}
179179

180+
MCP2515::ERROR MCP2515::setNormalOneShotMode()
181+
{
182+
return setMode(CANCTRL_REQOP_NORMAL | CANCTRL_OSM);
183+
}
184+
180185
MCP2515::ERROR MCP2515::setMode(const CANCTRL_REQOP_MODE mode)
181186
{
182-
modifyRegister(MCP_CANCTRL, CANCTRL_REQOP, mode);
187+
modifyRegister(MCP_CANCTRL, CANCTRL_REQOP | CANCTRL_OSM, mode);
183188

184189
unsigned long endTime = millis() + 10;
185190
bool modeMatch = false;

mcp2515.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ class MCP2515
473473
ERROR setSleepMode();
474474
ERROR setLoopbackMode();
475475
ERROR setNormalMode();
476+
ERROR setNormalOneShotMode();
476477
ERROR setClkOut(const CAN_CLKOUT divisor);
477478
ERROR setBitrate(const CAN_SPEED canSpeed);
478479
ERROR setBitrate(const CAN_SPEED canSpeed, const CAN_CLOCK canClock);

0 commit comments

Comments
 (0)