diff options
author | Eric Callahan <arksine.code@gmail.com> | 2022-06-03 06:09:53 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2022-06-03 14:51:01 -0400 |
commit | 39535b15ba2492608a4d1b2854df4faee920da53 (patch) | |
tree | c0300ad37f51bfefef038caa8939591e37a8d6a6 /src/stm32/can.c | |
parent | 3c7eea7336349475c03aa2fd186a5f73fc195d28 (diff) | |
download | kutter-39535b15ba2492608a4d1b2854df4faee920da53.tar.gz kutter-39535b15ba2492608a4d1b2854df4faee920da53.tar.xz kutter-39535b15ba2492608a4d1b2854df4faee920da53.zip |
stm32: use TME bits to find the canbus tx mailbox
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Diffstat (limited to 'src/stm32/can.c')
-rw-r--r-- | src/stm32/can.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/stm32/can.c b/src/stm32/can.c index ff88edb9..a82ad688 100644 --- a/src/stm32/can.c +++ b/src/stm32/can.c @@ -135,7 +135,11 @@ canbus_send(uint32_t id, uint32_t len, uint8_t *data) irq_enable(); return -1; } - int mbox = (tsr & CAN_TSR_CODE) >> CAN_TSR_CODE_Pos; + int mbox = 2; + if (tsr & CAN_TSR_TME0) + mbox = 0; + else if (tsr & CAN_TSR_TME1) + mbox = 1; CAN_TxMailBox_TypeDef *mb = &SOC_CAN->sTxMailBox[mbox]; /* Set up the DLC */ |