mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-10 18:15:59 +00:00
Fixed includes
This commit is contained in:
parent
e6b8bbab9c
commit
29ef79391a
@ -29,8 +29,7 @@
|
|||||||
#include <sta/config.hpp>
|
#include <sta/config.hpp>
|
||||||
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
||||||
|
|
||||||
|
#include <sta/bus/can/controller.hpp>
|
||||||
#include <sta/can/controller.hpp>
|
|
||||||
#include <sta/rtos/c_api/can_msg.h>
|
#include <sta/rtos/c_api/can_msg.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
||||||
|
|
||||||
#include <sta/assert.hpp>
|
#include <sta/assert.hpp>
|
||||||
#include <sta/can/subscribable.hpp>
|
#include <sta/bus/can/subscribable.hpp>
|
||||||
#include <sta/debug_serial.hpp>
|
#include <sta/debug_serial.hpp>
|
||||||
#include <sta/lang.hpp>
|
#include <sta/lang.hpp>
|
||||||
#include <sta/proto/isotp/transmitter.hpp>
|
#include <sta/proto/isotp/transmitter.hpp>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include <sta/rtos/defs.hpp>
|
#include <sta/rtos/defs.hpp>
|
||||||
#include <sta/rtos/system/can_bus.hpp>
|
#include <sta/rtos/system/can_bus.hpp>
|
||||||
#include <sta/rtos/system/events.hpp>
|
#include <sta/rtos/system/events.hpp>
|
||||||
#include <sta/stm32/hal.hpp>
|
#include <sta/devices/stm32/hal.hpp>
|
||||||
|
|
||||||
#include <cmsis_os2.h>
|
#include <cmsis_os2.h>
|
||||||
#include <FreeRTOS.h>
|
#include <FreeRTOS.h>
|
||||||
@ -28,10 +28,6 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
StaticTask_t canBusCB;
|
|
||||||
StaticQueue_t canBusDataQueueCB;
|
|
||||||
StaticQueue_t canBusSysQueueCB;
|
|
||||||
|
|
||||||
osThreadId_t canBusTaskHandle = nullptr;
|
osThreadId_t canBusTaskHandle = nullptr;
|
||||||
osMessageQueueId_t canBusDataQueueHandle = nullptr;
|
osMessageQueueId_t canBusDataQueueHandle = nullptr;
|
||||||
osMessageQueueId_t canBusSysQueueHandle = nullptr;
|
osMessageQueueId_t canBusSysQueueHandle = nullptr;
|
||||||
@ -388,65 +384,4 @@ namespace sta
|
|||||||
}
|
}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN driver thread entry function.
|
|
||||||
*/
|
|
||||||
void canBusTask(void *)
|
|
||||||
{
|
|
||||||
using namespace sta;
|
|
||||||
|
|
||||||
STA_ASSERT_MSG(canBusController != nullptr, "System CAN bus not initialized");
|
|
||||||
|
|
||||||
// Setup ISO-TP transceiver
|
|
||||||
AlpakaCanBus canBus(canBusController, HAL_GetTick, dummy::handleSysMessage, dummy::handleDataMessage);
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
uint32_t flags = osThreadFlagsWait(STA_RTOS_THREAD_FLAGS_VALID_BITS, osFlagsWaitAny, 50);
|
|
||||||
|
|
||||||
if (flags != static_cast<uint32_t>(osErrorTimeout))
|
|
||||||
{
|
|
||||||
STA_ASSERT_MSG((flags & osStatusReserved) == flags, "Unexpected error occurred in wait");
|
|
||||||
|
|
||||||
if (flags & STA_RTOS_CAN_FLAG_SYS_QUEUED)
|
|
||||||
{
|
|
||||||
// Take messages from queue until empty
|
|
||||||
CanSysMsg msg;
|
|
||||||
while (rtos::getCanBusMsg(&msg, 0))
|
|
||||||
{
|
|
||||||
canBus.send(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & STA_RTOS_CAN_FLAG_DATA_QUEUED)
|
|
||||||
{
|
|
||||||
// Take messages from queue until empty
|
|
||||||
CanDataMsg msg;
|
|
||||||
while (rtos::getCanBusMsg(&msg, 0))
|
|
||||||
{
|
|
||||||
canBus.send(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & STA_RTOS_CAN_FLAG_MSG_AVAIL)
|
|
||||||
{
|
|
||||||
STA_DEBUG_PRINTLN("[event] CAN INT");
|
|
||||||
|
|
||||||
canBus.processRx();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & STA_RTOS_CAN_FLAG_SHOW_STATS)
|
|
||||||
{
|
|
||||||
canBus.showStatistics();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process ISOTP transmissions
|
|
||||||
canBus.processTx();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // STA_RTOS_CAN_BUS_ENABLE
|
#endif // STA_RTOS_CAN_BUS_ENABLE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user