mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-06 09:37:34 +00:00
Added Publishing and handling of CAN state transition
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <sta/tacos/can_bus.hpp>
|
||||
#include <sta/debug/assert.hpp>
|
||||
#include <sta/tacos/manager.hpp>
|
||||
#include <sta/tacos.hpp>
|
||||
|
||||
extern CAN_HandleTypeDef STA_STM32_CAN_HANDLE;
|
||||
|
||||
@@ -149,7 +150,13 @@ namespace sta {
|
||||
{
|
||||
void handleSysMessage(CanMsgHeader & header, uint8_t * payload)
|
||||
{
|
||||
// This is a weak function that can be overridden by the user
|
||||
// This is a weak function that can be overridden by the user,
|
||||
// if they want to handle system messages in a different way, i.e. ignore them
|
||||
|
||||
STA_ASSERT(header.payloadLength == 2);
|
||||
|
||||
// First byte of payload is the origin state, second byte is the destination state
|
||||
tacos::setState(payload[0], payload[1]);
|
||||
}
|
||||
} // namespace tacos
|
||||
} // namespace sta
|
||||
|
@@ -29,6 +29,19 @@ namespace sta
|
||||
bool queueCanBusMsg(CanSysMsg & msg, uint32_t timeout){
|
||||
return CanBus::instance()->queueCanBusMsg(msg, timeout);
|
||||
}
|
||||
|
||||
bool publishState(uint32_t from, uint32_t to, uint32_t lockout /* = 0 */){
|
||||
CanSysMsg msg;
|
||||
msg.header.sid = STA_TACOS_CAN_BUS_SYS_MSG_ID;
|
||||
msg.header.payloadLength = 2;
|
||||
msg.payload[0] = from;
|
||||
msg.payload[1] = to;
|
||||
|
||||
msg.header.eid = 0;
|
||||
msg.header.format = 0;
|
||||
|
||||
return CanBus::instance()->queueCanBusMsg(msg, lockout);
|
||||
}
|
||||
} // namespace tacos
|
||||
|
||||
} // namespace sta
|
||||
|
Reference in New Issue
Block a user