Skip to content

[STM32F4 family] Assign CAN filter number properly #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static can_irq_handler irq_handler;

void can_init(can_t *obj, PinName rd, PinName td)
{
uint32_t filter_number;
CANName can_rd = (CANName)pinmap_peripheral(rd, PinMap_CAN_RD);
CANName can_td = (CANName)pinmap_peripheral(td, PinMap_CAN_TD);
obj->can = (CANName)pinmap_merge(can_rd, can_td);
Expand Down Expand Up @@ -71,7 +72,10 @@ void can_init(can_t *obj, PinName rd, PinName td)
if (HAL_CAN_Init(&CanHandle) != HAL_OK) {
error("Cannot initialize CAN");
}
can_filter(obj, 0, 0, CANStandard, 0);

filter_number = (obj->can == CAN_1) ? 0 : 14;

can_filter(obj, 0, 0, CANStandard, filter_number);
}

void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id)
Expand Down