stm32/f1/can: Add function to detect if can system has an available mailbox
This commit is contained in:
parent
ffe392c11b
commit
dd5e797d61
1 changed files with 13 additions and 0 deletions
|
@ -313,3 +313,16 @@ void can_receive(u32 canport, u8 fifo, bool release, u32 *id, bool *ext,
|
|||
if (release)
|
||||
can_fifo_release(CAN1, 0);
|
||||
}
|
||||
|
||||
bool can_available_mailbox(u32 canport)
|
||||
{
|
||||
if ((CAN_TSR(canport) & CAN_TSR_TME0) == CAN_TSR_TME0) {
|
||||
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…
Reference in a new issue