From 19cd458ae622310d4de8797cc190da2d9d2d7d0a Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 2 Jul 2015 22:19:12 +0300 Subject: [PATCH] Temporary fix to STM32 driver --- libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp index 53b87e13e0..82c99f0d08 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp @@ -551,7 +551,10 @@ void CanIface::discardTimedOutTxMailboxes(uavcan::MonotonicTime current_time) bool CanIface::isTxBufferFull() const { - return (can_->TSR & (bxcan::TSR_TME0 | bxcan::TSR_TME1 | bxcan::TSR_TME2)) == 0; // Interrupts enabled + // TODO FIXME HACK: Implement proper arbitration instead of a one-by-one transmission. + // This function can be executed outside of a critical section. + static const uavcan::uint32_t TME = bxcan::TSR_TME0 | bxcan::TSR_TME1 | bxcan::TSR_TME2; + return (can_->TSR & TME) != TME; // All empty! } bool CanIface::isRxBufferEmpty() const