bxCAN: Shift filter ID/mask

This commit is contained in:
Jasper Blanckenburg 2023-03-18 21:16:56 +01:00
parent eb74553f89
commit b2929ad664
1 changed files with 6 additions and 6 deletions

View File

@ -32,14 +32,14 @@ HAL_StatusTypeDef ftcan_add_filter(uint16_t id, uint16_t mask) {
static uint32_t next_filter_no = 0;
static CAN_FilterTypeDef filter;
if (next_filter_no % 2 == 0) {
filter.FilterIdHigh = id;
filter.FilterMaskIdHigh = mask;
filter.FilterIdLow = 0;
filter.FilterMaskIdLow = 0xFFFF;
filter.FilterIdHigh = id << 5;
filter.FilterMaskIdHigh = mask << 5;
filter.FilterIdLow = id << 5;
filter.FilterMaskIdLow = mask << 5;
} else {
// Leave high filter untouched from the last configuration
filter.FilterIdLow = id;
filter.FilterMaskIdLow = mask;
filter.FilterIdLow = id << 5;
filter.FilterMaskIdLow = mask << 5;
}
filter.FilterFIFOAssignment = CAN_FILTER_FIFO0;
filter.FilterBank = next_filter_no / 2;