rtos2-utils/include/sta/rtos/easy_config.hpp
2022-05-24 14:00:46 +02:00

82 lines
2.3 KiB
C++

/**
* @file
* @brief Helper for easy system task setup in `<sta/config.hpp>`.
*/
#ifndef STA_RTOS_EASY_CONFIG_HPP
#define STA_RTOS_EASY_CONFIG_HPP
#include <sta/rtos/system/names.hpp>
/**
* @defgroup STA_RTOS_EasyConfig Easy Config
* @ingroup STA_RTOS_BuildConfig
* @brief Helpers for easy RTOS module setup.
*
* Use this header only inside the <sta/config.hpp> header of your application.
*/
#ifdef DOXYGEN
/**
* @brief Don't warn about use of <rtos2/easy_config.hpp> outside of <sta/config.hpp>.
*
* @ingroup STA_RTOS_EasyConfig
*/
# define STA_RTOS_EASY_CONFIG_NO_WARNING
#endif // DOXYGEN
#if !defined(STA_CONFIG_HPP) && !defined(STA_RTOS_EASY_CONFIG_NO_WARNING)
#warning "Intended for use in <sta/config.hpp>"
#endif // !STA_CONFIG_HPP && !STA_RTOS_EASY_CONFIG_NO_WARNING
#ifdef DOXYGEN
/**
* @brief Enable all system tasks and required features.
*
* @ingroup STA_RTOS_EasyConfig
*/
# define STA_RTOS_EASY_CONFIG_SYSTEM_TASKS_ENABLE
#endif // DOXYGEN
#ifdef STA_RTOS_EASY_CONFIG_SYSTEM_TASKS_ENABLE
// Enable system events used by system tasks
# define STA_RTOS_SYSTEM_EVENT_ENABLE
// Enable system tasks
# define STA_RTOS_WATCHDOG_ENABLE
# define STA_RTOS_STARTUP_ENABLE
#endif // STA_RTOS_EASY_CONFIG_SYSTEM_TASKS_ENABLE
#ifdef DOXYGEN
/**
* @brief Common base name used for watchdog timer handle and callback names.
*
* @ingroup STA_RTOS_EasyConfig
*/
# define STA_RTOS_EASY_CONFIG_WATCHDOG_TIMER_NAME
#endif // DOXYGEN
#ifdef STA_RTOS_EASY_CONFIG_WATCHDOG_TIMER_NAME
# define STA_RTOS_WATCHDOG_TIMER_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_EASY_CONFIG_WATCHDOG_TIMER_NAME)
# define STA_RTOS_WATCHDOG_TIMER_CALLBACK STA_RTOS_MAKE_CALLBACK_NAME(STA_RTOS_EASY_CONFIG_WATCHDOG_TIMER_NAME)
#endif // STA_RTOS_EASY_CONFIG_WATCHDOG_TIMER_NAME
#ifdef DOXYGEN
/**
* @brief Common base name used for watchdog task handle and entry function names.
*
* @ingroup STA_RTOS_EasyConfig
*/
# define STA_RTOS_EASY_CONFIG_WATCHDOG_NAME
#endif // DOXYGEN
#ifdef STA_RTOS_EASY_CONFIG_WATCHDOG_NAME
# define STA_RTOS_WATCHDOG_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_EASY_CONFIG_WATCHDOG_NAME)
# define STA_RTOS_WATCHDOG_ENTRY_FUNCTION STA_RTOS_MAKE_TASK_NAME(STA_RTOS_EASY_CONFIG_WATCHDOG_NAME)
#endif // STA_RTOS_EASY_CONFIG_WATCHDOG_NAME
#endif // STA_RTOS_EASY_CONFIG_HPP