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 uint32_t next_filter_no = 0;
|
||||||
static CAN_FilterTypeDef filter;
|
static CAN_FilterTypeDef filter;
|
||||||
if (next_filter_no % 2 == 0) {
|
if (next_filter_no % 2 == 0) {
|
||||||
filter.FilterIdHigh = id;
|
filter.FilterIdHigh = id << 5;
|
||||||
filter.FilterMaskIdHigh = mask;
|
filter.FilterMaskIdHigh = mask << 5;
|
||||||
filter.FilterIdLow = 0;
|
filter.FilterIdLow = id << 5;
|
||||||
filter.FilterMaskIdLow = 0xFFFF;
|
filter.FilterMaskIdLow = mask << 5;
|
||||||
} else {
|
} else {
|
||||||
// Leave high filter untouched from the last configuration
|
// Leave high filter untouched from the last configuration
|
||||||
filter.FilterIdLow = id;
|
filter.FilterIdLow = id << 5;
|
||||||
filter.FilterMaskIdLow = mask;
|
filter.FilterMaskIdLow = mask << 5;
|
||||||
}
|
}
|
||||||
filter.FilterFIFOAssignment = CAN_FILTER_FIFO0;
|
filter.FilterFIFOAssignment = CAN_FILTER_FIFO0;
|
||||||
filter.FilterBank = next_filter_no / 2;
|
filter.FilterBank = next_filter_no / 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user