CAN implementation for standard CAN

This commit is contained in:
@CarlWachter
2024-03-08 13:55:01 +01:00
parent f0176bb2ed
commit 7147d6de83
5 changed files with 59 additions and 24 deletions

View File

@@ -78,9 +78,7 @@ namespace sta
return thread_ptr;
}
bool queueCanBusMsg(const CanDataMsg & msg, uint32_t timeout);
bool queueCanBusMsg(const CanSysMsg & msg, uint32_t timeout);
bool queueCanBusMsg(CanSysMsg & msg, uint32_t timeout);
} // namespace tacos
}

View File

@@ -12,6 +12,8 @@
#include <sta/config.hpp>
#include <sta/rtos/thread.hpp>
#include <sta/rtos/queue.hpp>
#include <sta/rtos/system/can_bus.hpp>
/**
* @defgroup tacos_thread TACOS Thread
@@ -126,6 +128,24 @@ namespace sta
*/
void sleep(uint32_t ticks);
#ifdef STA_CAN_BUS_ENABLE
/**
* @brief Set the ID of the CAN bus this thread is associated with.
*
* @param canID
*/
void setCanID(uint32_t canID);
/**
* @brief Get the ID of the CAN bus this thread is associated with.
*
* @return can ID
*/
uint32_t getCanID();
sta::RtosQueue<CanSysMsg> CAN_queue_;
#endif // STA_CAN_BUS_ENABLE
#ifdef STA_TACOS_WATCHDOG_ENABLED
/**
* @brief This macro wraps a given statement into waiting() and heartbeat() to make the code more readable.
@@ -191,6 +211,9 @@ namespace sta
bool running_;
#ifdef STA_TACOS_WATCHDOG_ENABLED
ThreadStatus status_;
#endif // STA_TACOS_WATCHDOG_ENABLED
#ifdef STA_CAN_BUS_ENABLE
uint32_t canID_;
#endif // STA_TACOS_WATCHDOG_ENABLED
bool terminate_;
};