stm32/f1/can: clean up can_available_mailbox ->fewer 'if' statements
This commit is contained in:
parent
7e9b79aa55
commit
fa1d5f8e43
@ -316,13 +316,5 @@ void can_receive(u32 canport, u8 fifo, bool release, u32 *id, bool *ext,
|
|||||||
|
|
||||||
bool can_available_mailbox(u32 canport)
|
bool can_available_mailbox(u32 canport)
|
||||||
{
|
{
|
||||||
if ((CAN_TSR(canport) & CAN_TSR_TME0) == CAN_TSR_TME0) {
|
return CAN_TSR(canport) & (CAN_TSR_TME0 | CAN_TSR_TME1 | CAN_TSR_TME2);
|
||||||
return true;
|
|
||||||
} else if ((CAN_TSR(canport) & CAN_TSR_TME1) == CAN_TSR_TME1) {
|
|
||||||
return true;
|
|
||||||
} else if ((CAN_TSR(canport) & CAN_TSR_TME2) == CAN_TSR_TME2) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user