brtaylor
Well-known member
Regarding the method names, I think this would be better (swap the name Manual and Filter to match how you're naming the UserFilter methods):
I think I have the setMBManualFilter working well for both STD and EXT ID mailboxes, the bit shift is incorporated into the method:
Code:
FCTP_FUNC bool FCTP_OPT::setMBManualFilter(FLEXCAN_MAILBOX mb_num, uint32_t id1, uint32_t mask);
FCTP_FUNC bool FCTP_OPT::setFIFOManualFilter(uint8_t filter, uint32_t id1, uint32_t mask, const FLEXCAN_IDE &ide, const FLEXCAN_IDE &remote);
I think I have the setMBManualFilter working well for both STD and EXT ID mailboxes, the bit shift is incorporated into the method:
Code:
FCTP_FUNC bool FCTP_OPT::setMBManualFilter(FLEXCAN_MAILBOX mb_num, uint32_t id1, uint32_t mask) {
if ( mb_num < mailboxOffset() || mb_num >= FLEXCANb_MAXMB_SIZE(_bus) ) return 0; /* mailbox not available */
if ( (FLEXCAN_get_code(FLEXCANb_MBn_CS(_bus, mb_num)) >> 3) ) return 0; /* exit on TX mailbox */
if (!(FLEXCANb_MBn_CS(_bus, mb_num) & FLEXCAN_MB_CS_IDE)) {
mask = mask << 18; /* shift mask by 18 for 11 bit filters */
}
setMBFilterProcessing(mb_num,id1,mask);
filter_store(FLEXCAN_MULTI, mb_num, 1, id1, 0, 0, 0, 0);
return 1;
}