Merge pull request 'Small bugfix and adapted naming' (#29) from fix/can-less into main

Reviewed-on: https://git.intern.spaceteamaachen.de/ALPAKA/TACOS/pulls/29
Reviewed-by: carlwachter <carlwachter@noreply.git.intern.spaceteamaachen.de>
This commit is contained in:
carlwachter 2024-05-22 13:33:13 +00:00
commit ad93e99cc0
5 changed files with 12 additions and 6 deletions

View File

@ -72,7 +72,7 @@ To enable the CAN Bus two things need to be done:
1. Enable CAN in the IOC with the RX0 and RX1 Interrupts enabled. 1. Enable CAN in the IOC with the RX0 and RX1 Interrupts enabled.
2. Add the following code to the `sta/config.hpp` file: 2. Add the following code to the `sta/config.hpp` file:
``` ```
#define STA_CAN_BUS_ENABLE #define STA_TACOS_CAN_BUS_ENABLE
``` ```
PS: For not officially supported chips add this: PS: For not officially supported chips add this:
``` ```

View File

@ -78,6 +78,7 @@ namespace sta
return thread_ptr; return thread_ptr;
} }
#ifdef STA_TACOS_CAN_BUS_ENABLED
/** /**
* @brief Queue a message to be sent over the CAN bus. * @brief Queue a message to be sent over the CAN bus.
* *
@ -102,7 +103,7 @@ namespace sta
* @ingroup tacos_api * @ingroup tacos_api
*/ */
bool publishState(uint32_t from, uint32_t to, uint32_t lockout = 0); bool publishState(uint32_t from, uint32_t to, uint32_t lockout = 0);
#endif // STA_TACOS_CAN_BUS_ENABLED
} // namespace tacos } // namespace tacos
} }

View File

@ -3,7 +3,7 @@
#include <sta/config.hpp> #include <sta/config.hpp>
#ifdef STA_CAN_BUS_ENABLE #ifdef STA_TACOS_CAN_BUS_ENABLED
#include <sta/rtos/queue.hpp> #include <sta/rtos/queue.hpp>
#include <sta/rtos/system/can_bus.hpp> #include <sta/rtos/system/can_bus.hpp>
@ -13,6 +13,9 @@
#include <sta/tacos/thread.hpp> #include <sta/tacos/thread.hpp>
#include <sta/tacos/statemachine.hpp> #include <sta/tacos/statemachine.hpp>
#ifndef STA_STM32_CAN_ENABLED
# error "CAN has to be enabled in the IOC first"
#endif // STA_STM32_CAN_ENABLED
/** /**
* @defgroup tacos_can_bus Can Bus Task * @defgroup tacos_can_bus Can Bus Task
@ -117,5 +120,5 @@ namespace sta
} /* namespace sta */ } /* namespace sta */
#endif /* STA_CAN_BUS_ENABLE */ #endif /* STA_TACOS_CAN_BUS_ENABLED */
#endif /* INCLUDE_TACOS_CAN_BUS_HPP_ */ #endif /* INCLUDE_TACOS_CAN_BUS_HPP_ */

View File

@ -1,5 +1,5 @@
#include <sta/config.hpp> #include <sta/config.hpp>
#ifdef STA_CAN_BUS_ENABLE #ifdef STA_TACOS_CAN_BUS_ENABLED
#include <sta/tacos/can_bus.hpp> #include <sta/tacos/can_bus.hpp>
#include <sta/debug/assert.hpp> #include <sta/debug/assert.hpp>
@ -161,4 +161,4 @@ namespace sta {
} // namespace tacos } // namespace tacos
} // namespace sta } // namespace sta
#endif // STA_CAN_BUS_ENABLE #endif // STA_TACOS_CAN_BUS_ENABLED

View File

@ -26,6 +26,7 @@ namespace sta
Statemachine::instance()->requestTimedStateTransition(from, to, millis, lockout); Statemachine::instance()->requestTimedStateTransition(from, to, millis, lockout);
} }
#ifdef STA_TACOS_CAN_BUS_ENABLED
bool queueCanBusMsg(CanSysMsg & msg, uint32_t timeout){ bool queueCanBusMsg(CanSysMsg & msg, uint32_t timeout){
return CanBus::instance()->queueCanBusMsg(msg, timeout); return CanBus::instance()->queueCanBusMsg(msg, timeout);
} }
@ -42,6 +43,7 @@ namespace sta
return CanBus::instance()->queueCanBusMsg(msg, lockout); return CanBus::instance()->queueCanBusMsg(msg, lockout);
} }
#endif // STA_TACOS_CAN_BUS_ENABLED
} // namespace tacos } // namespace tacos
} // namespace sta } // namespace sta