Skip to content

Commit

Permalink
Merge pull request #86 from 107-systems/fix-filter
Browse files Browse the repository at this point in the history
Fix: When writing filter IDs the writing should start from SIDH.
  • Loading branch information
aentinger authored Apr 18, 2023
2 parents 0edce58 + b984fcf commit 7e475ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion examples/MCP2515-Filter/MCP2515-Filter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ void setup()

mcp2515.begin();
mcp2515.setBitRate(CanBitRate::BR_250kBPS_16MHZ); // CAN bit rate and MCP2515 clock speed
mcp2515.setListenOnlyMode();

/* Enable filtering of CAN messages. The MCP2515 has two message receive buffers.
* For each message receive buffer a filter mask can be defined. In addition, for
Expand Down Expand Up @@ -95,6 +94,9 @@ void setup()
0x00000008
};
mcp2515.enableFilter(MCP2515::RxB::RxB1, RXMB1_MASK, RXMB1_FILTER, RXMB1_FILTER_SIZE);

/* Leave configuration mode and start listening. */
mcp2515.setListenOnlyMode();
}

void loop()
Expand Down
12 changes: 6 additions & 6 deletions src/MCP2515/MCP2515_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ class MCP2515_Config
bool setMode (Mode const mode);
void setBitRateConfig (CanBitRateConfig const bit_rate_config);

inline void setFilterId_RxF0 (uint32_t const id) { setFilterId(Register::RXF0SIDL, id); }
inline void setFilterId_RxF1 (uint32_t const id) { setFilterId(Register::RXF1SIDL, id); }
inline void setFilterId_RxF2 (uint32_t const id) { setFilterId(Register::RXF2SIDL, id); }
inline void setFilterId_RxF3 (uint32_t const id) { setFilterId(Register::RXF3SIDL, id); }
inline void setFilterId_RxF4 (uint32_t const id) { setFilterId(Register::RXF4SIDL, id); }
inline void setFilterId_RxF5 (uint32_t const id) { setFilterId(Register::RXF5SIDL, id); }
inline void setFilterId_RxF0 (uint32_t const id) { setFilterId(Register::RXF0SIDH, id); }
inline void setFilterId_RxF1 (uint32_t const id) { setFilterId(Register::RXF1SIDH, id); }
inline void setFilterId_RxF2 (uint32_t const id) { setFilterId(Register::RXF2SIDH, id); }
inline void setFilterId_RxF3 (uint32_t const id) { setFilterId(Register::RXF3SIDH, id); }
inline void setFilterId_RxF4 (uint32_t const id) { setFilterId(Register::RXF4SIDH, id); }
inline void setFilterId_RxF5 (uint32_t const id) { setFilterId(Register::RXF5SIDH, id); }
inline void setFilterMask_RxB0(uint32_t const mask) { setFilterMask(Register::RXM0SIDH, mask); }
inline void setFilterMask_RxB1(uint32_t const mask) { setFilterMask(Register::RXM1SIDH, mask); }

Expand Down

0 comments on commit 7e475ae

Please sign in to comment.