Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/mcp2515/mcp2515.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,17 @@ MCP2515::ERROR MCP2515::setClkOut(const CAN_CLKOUT divisor)
return ERROR_OK;
}

MCP2515::ERROR MCP2515::setSleepWakeup(const bool enable)
{
ERROR res = setConfigMode();
if (res != ERROR_OK) {
return res;
}

modifyRegister(MCP_CANINTE, 0b01000000, enable * 0xFF);
return ERROR_OK;
}

void MCP2515::prepareId(uint8_t *buffer, const bool ext, const uint32_t id)
{
uint16_t canid = (uint16_t)(id & 0x0FFFF);
Expand Down
1 change: 1 addition & 0 deletions include/mcp2515/mcp2515.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class MCP2515 {
ERROR setBitrate(const CAN_SPEED canSpeed, const CAN_CLOCK canClock);
ERROR setFilterMask(const MASK num, const bool ext, const uint32_t ulData);
ERROR setFilter(const RXF num, const bool ext, const uint32_t ulData);
ERROR setSleepWakeup(const bool enable);
ERROR sendMessage(const TXBn txbn, const struct can_frame *frame);
ERROR sendMessage(const struct can_frame *frame);
ERROR readMessage(const RXBn rxbn, struct can_frame *frame);
Expand Down