bxCAN: Shift filter ID/mask
This commit is contained in:
parent
eb74553f89
commit
b2929ad664
12
can-halal.c
12
can-halal.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue