diff --git a/README.md b/README.md index 97ea1a7..5fec4c4 100644 --- a/README.md +++ b/README.md @@ -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. 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: ``` diff --git a/include/sta/tacos.hpp b/include/sta/tacos.hpp index 4672dbf..b7b6ccf 100644 --- a/include/sta/tacos.hpp +++ b/include/sta/tacos.hpp @@ -78,6 +78,7 @@ namespace sta return thread_ptr; } +#ifdef STA_TACOS_CAN_BUS_ENABLED /** * @brief Queue a message to be sent over the CAN bus. * @@ -102,7 +103,7 @@ namespace sta * @ingroup tacos_api */ bool publishState(uint32_t from, uint32_t to, uint32_t lockout = 0); - +#endif // STA_TACOS_CAN_BUS_ENABLED } // namespace tacos } diff --git a/include/sta/tacos/can_bus.hpp b/include/sta/tacos/can_bus.hpp index 216c370..750292e 100644 --- a/include/sta/tacos/can_bus.hpp +++ b/include/sta/tacos/can_bus.hpp @@ -3,7 +3,7 @@ #include -#ifdef STA_CAN_BUS_ENABLE +#ifdef STA_TACOS_CAN_BUS_ENABLED #include #include @@ -13,6 +13,9 @@ #include #include +#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 @@ -117,5 +120,5 @@ namespace sta } /* namespace sta */ -#endif /* STA_CAN_BUS_ENABLE */ +#endif /* STA_TACOS_CAN_BUS_ENABLED */ #endif /* INCLUDE_TACOS_CAN_BUS_HPP_ */ diff --git a/src/can_bus.cpp b/src/can_bus.cpp index 52656c6..39f2387 100644 --- a/src/can_bus.cpp +++ b/src/can_bus.cpp @@ -1,5 +1,5 @@ #include -#ifdef STA_CAN_BUS_ENABLE +#ifdef STA_TACOS_CAN_BUS_ENABLED #include #include @@ -161,4 +161,4 @@ namespace sta { } // namespace tacos } // namespace sta -#endif // STA_CAN_BUS_ENABLE +#endif // STA_TACOS_CAN_BUS_ENABLED diff --git a/src/tacos.cpp b/src/tacos.cpp index b4e4ba3..ca50225 100644 --- a/src/tacos.cpp +++ b/src/tacos.cpp @@ -26,6 +26,7 @@ namespace sta Statemachine::instance()->requestTimedStateTransition(from, to, millis, lockout); } +#ifdef STA_TACOS_CAN_BUS_ENABLED bool queueCanBusMsg(CanSysMsg & msg, uint32_t timeout){ return CanBus::instance()->queueCanBusMsg(msg, timeout); } @@ -42,6 +43,7 @@ namespace sta return CanBus::instance()->queueCanBusMsg(msg, lockout); } +#endif // STA_TACOS_CAN_BUS_ENABLED } // namespace tacos } // namespace sta