mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-06-10 16:45:59 +00:00
feat(can): tx callback
This commit is contained in:
parent
6c92ad7735
commit
0b24d78835
@ -79,6 +79,11 @@ namespace sta
|
|||||||
*/
|
*/
|
||||||
void canCallback(uint32_t fifo);
|
void canCallback(uint32_t fifo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Notify the system that a message was transmitted. Used to avoid overwriting the message buffer.
|
||||||
|
*/
|
||||||
|
void txCallback();
|
||||||
|
|
||||||
void init() override;
|
void init() override;
|
||||||
void func() override;
|
void func() override;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace sta
|
|||||||
void CanBus::func()
|
void CanBus::func()
|
||||||
{
|
{
|
||||||
messageEvent.clear(STA_RTOS_CAN_ANY);
|
messageEvent.clear(STA_RTOS_CAN_ANY);
|
||||||
uint32_t flags = messageEvent.wait(STA_RTOS_CAN_ANY, osWaitForever);
|
uint32_t flags = messageEvent.wait(STA_RTOS_CAN_FLAG_SYS_QUEUED | STA_RTOS_CAN_FLAG_MSG_AVAIL, osWaitForever);
|
||||||
|
|
||||||
if (flags != static_cast<uint32_t>(osErrorTimeout))
|
if (flags != static_cast<uint32_t>(osErrorTimeout))
|
||||||
{
|
{
|
||||||
@ -47,6 +47,8 @@ namespace sta
|
|||||||
CanSysMsg msg;
|
CanSysMsg msg;
|
||||||
while (CanBus::_instance->getCanBusMsg(&msg, 0))
|
while (CanBus::_instance->getCanBusMsg(&msg, 0))
|
||||||
{
|
{
|
||||||
|
// wait for the mailbox to be free, but only for a very short time
|
||||||
|
messageEvent.wait(STA_RTOS_TX_MAILBOX_COMPLETE, 1);
|
||||||
canBus_.send(msg);
|
canBus_.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,6 +134,11 @@ namespace sta
|
|||||||
return (canBusSysQueue_.get(msg, timeout));
|
return (canBusSysQueue_.get(msg, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CanBus::txCallback()
|
||||||
|
{
|
||||||
|
messageEvent.set(STA_RTOS_TX_MAILBOX_COMPLETE);
|
||||||
|
}
|
||||||
|
|
||||||
CanBus *CanBus::_instance = nullptr;
|
CanBus *CanBus::_instance = nullptr;
|
||||||
|
|
||||||
RtosEvent CanBus::messageEvent;
|
RtosEvent CanBus::messageEvent;
|
||||||
@ -147,6 +154,11 @@ namespace sta
|
|||||||
sta::tacos::CanBus::instance()->canCallback(fifo);
|
sta::tacos::CanBus::instance()->canCallback(fifo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CanBus_TxMailboxCompleteCallback()
|
||||||
|
{
|
||||||
|
sta::tacos::CanBus::instance()->txCallback();
|
||||||
|
}
|
||||||
|
|
||||||
namespace tacos
|
namespace tacos
|
||||||
{
|
{
|
||||||
STA_WEAK
|
STA_WEAK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user