mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-06-12 01:25:59 +00:00
CAN Bus shifted to TACOS from rtos
This commit is contained in:
parent
db43a3c7df
commit
7da60dc85e
@ -50,7 +50,7 @@ In order to use TACOS, you need to provide a configuration file in the path `sta
|
|||||||
#define STA_RTOS_SYSTEM_EVENTS_ENABLE
|
#define STA_RTOS_SYSTEM_EVENTS_ENABLE
|
||||||
// #define STA_RTOS_SYSTEM_WATCHDOG_ENABLE
|
// #define STA_RTOS_SYSTEM_WATCHDOG_ENABLE
|
||||||
// #define STA_RTOS_WATCHDOG_ENABLE
|
// #define STA_RTOS_WATCHDOG_ENABLE
|
||||||
#define STA_RTOS_CAN_BUS_ENABLE
|
#define STA_CAN_BUS_ENABLE
|
||||||
|
|
||||||
// Statemachine settings.
|
// Statemachine settings.
|
||||||
#define STA_TACOS_NUM_STATES 3
|
#define STA_TACOS_NUM_STATES 3
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <sta/config.hpp>
|
#include <sta/config.hpp>
|
||||||
|
|
||||||
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
#ifdef STA_CAN_BUS_ENABLE
|
||||||
|
|
||||||
#include <sta/tacos/thread.hpp>
|
#include <sta/tacos/thread.hpp>
|
||||||
#include <sta/rtos/queue.hpp>
|
#include <sta/rtos/queue.hpp>
|
||||||
@ -127,5 +127,5 @@ namespace sta
|
|||||||
|
|
||||||
} /* namespace sta */
|
} /* namespace sta */
|
||||||
|
|
||||||
#endif /* STA_RTOS_CAN_BUS_ENABLE */
|
#endif /* STA_CAN_BUS_ENABLE */
|
||||||
#endif /* INCLUDE_TACOS_CAN_BUS_HPP_ */
|
#endif /* INCLUDE_TACOS_CAN_BUS_HPP_ */
|
||||||
|
@ -1,24 +1,11 @@
|
|||||||
#include <sta/config.hpp>
|
#include <sta/config.hpp>
|
||||||
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
#ifdef STA_CAN_BUS_ENABLE
|
||||||
|
|
||||||
#include <sta/tacos/can_bus.hpp>
|
#include <sta/tacos/can_bus.hpp>
|
||||||
#include <sta/rtos/system/can_bus.hpp>
|
#include <sta/rtos/system/can_bus.hpp>
|
||||||
#include <sta/debug/debug.hpp>
|
#include <sta/debug/debug.hpp>
|
||||||
#include <sta/debug/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
|
|
||||||
namespace sta
|
|
||||||
{
|
|
||||||
namespace rtos
|
|
||||||
{
|
|
||||||
|
|
||||||
void initCanBus()
|
|
||||||
{
|
|
||||||
sta::tacos::CanBus::instance(getCanController())->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace rtos
|
|
||||||
} // namespace sta
|
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
namespace tacos
|
namespace tacos
|
||||||
@ -206,4 +193,4 @@ namespace sta {
|
|||||||
} // namespace tacos
|
} // namespace tacos
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
#endif // STA_RTOS_CAN_BUS_ENABLE
|
#endif // STA_CAN_BUS_ENABLE
|
@ -29,7 +29,10 @@
|
|||||||
#include <sta/tacos/manager.hpp>
|
#include <sta/tacos/manager.hpp>
|
||||||
#include <sta/tacos/statemachine.hpp>
|
#include <sta/tacos/statemachine.hpp>
|
||||||
#include <sta/tacos/watchdog.hpp>
|
#include <sta/tacos/watchdog.hpp>
|
||||||
|
#include <sta/tacos/can_bus.hpp>
|
||||||
|
|
||||||
|
// TODO: WHY DO I HAVE TO PUT THIS HERE???? DO YOU THINK YOU ARE SPECIAL, HUH MR. HCAN1? WHY CAN'T YOU BE NORMAL LIKE HUART
|
||||||
|
extern CAN_HandleTypeDef hcan1;
|
||||||
|
|
||||||
// The UART mutex defined in freertos.c
|
// The UART mutex defined in freertos.c
|
||||||
extern osMutexId_t uartMutexHandle;
|
extern osMutexId_t uartMutexHandle;
|
||||||
@ -39,12 +42,6 @@ extern osMutexId_t uartMutexHandle;
|
|||||||
* @ingroup tacos
|
* @ingroup tacos
|
||||||
* @brief Functions that are called during startup.
|
* @brief Functions that are called during startup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// CAN Handle
|
|
||||||
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
|
||||||
extern CAN_HandleTypeDef hcan1;
|
|
||||||
#endif /* STA_RTOS_CAN_BUS_ENABLE */
|
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
#ifdef STA_DEBUGGING_ENABLED
|
#ifdef STA_DEBUGGING_ENABLED
|
||||||
@ -63,6 +60,18 @@ namespace sta
|
|||||||
return &STA_STM32_USART_HANDLE;
|
return &STA_STM32_USART_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(STA_CAN_BUS_ENABLE) || defined(DOXYGEN)
|
||||||
|
/**
|
||||||
|
* @brief Function that returns the CAN handle used for the CAN bus. Override it in userspace to adjust.
|
||||||
|
*
|
||||||
|
* @ingroup tacos_startup
|
||||||
|
*/
|
||||||
|
STA_WEAK
|
||||||
|
CAN_HandleTypeDef * getCanController(){
|
||||||
|
return &STA_STM32_CAN_HANDLE;
|
||||||
|
}
|
||||||
|
#endif /* STA_CAN_BUS_ENABLE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function that initializes the printable object given by getUARThandle().
|
* @brief Function that initializes the printable object given by getUARThandle().
|
||||||
*
|
*
|
||||||
@ -134,6 +143,23 @@ namespace sta
|
|||||||
extern CAN_HandleTypeDef hcan1;
|
extern CAN_HandleTypeDef hcan1;
|
||||||
return new STM32CanController(&hcan1);
|
return new STM32CanController(&hcan1);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief Function that is called before the Can Bus task is started. Override it to adjust
|
||||||
|
* the Can bus to your specifications.
|
||||||
|
*
|
||||||
|
* @ingroup tacos_startup
|
||||||
|
*/
|
||||||
|
STA_WEAK
|
||||||
|
void onCanBusInit()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void initCanBus()
|
||||||
|
{
|
||||||
|
onCanBusInit();
|
||||||
|
|
||||||
|
CanBus::instance(getCanController())->start();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace tacos
|
} // namespace tacos
|
||||||
|
|
||||||
|
|
||||||
@ -153,15 +179,11 @@ namespace sta
|
|||||||
#ifdef STA_TACOS_WATCHDOG_ENABLED
|
#ifdef STA_TACOS_WATCHDOG_ENABLED
|
||||||
tacos::initWatchdog();
|
tacos::initWatchdog();
|
||||||
#endif // STA_TACOS_WATCHDOG_ENABLED
|
#endif // STA_TACOS_WATCHDOG_ENABLED
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef STA_RTOS_CAN_BUS_ENABLE
|
#ifdef STA_CAN_BUS_ENABLE
|
||||||
STA_WEAK
|
tacos::initCanBus();
|
||||||
CAN_HandleTypeDef * getCanController(){
|
#endif // STA_CAN_BUS_ENABLE
|
||||||
return &hcan1;
|
|
||||||
}
|
}
|
||||||
#endif /* STA_RTOS_CAN_BUS_ENABLE */
|
|
||||||
|
|
||||||
} // namespace rtos
|
} // namespace rtos
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user