mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Change module enable logic
This commit is contained in:
@@ -14,14 +14,6 @@
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/**
|
||||
* @def STA_STM32_CAN_ENABLE
|
||||
* @brief Enable module.
|
||||
*
|
||||
* @ingroup stm32BuildConfig
|
||||
*/
|
||||
# define STA_STM32_CAN_ENABLE
|
||||
|
||||
/**
|
||||
* @def STA_STM32_CAN_GLOBAL
|
||||
* @brief Create global CanBus object using this CAN instance.
|
||||
@@ -32,12 +24,20 @@
|
||||
#endif // DOXYGEN
|
||||
|
||||
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL CAN module enabled
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STM32_CAN_ENABLE
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
# include <sta/stm32/hal.hpp>
|
||||
# ifdef HAL_CAN_MODULE_ENABLED
|
||||
# define STA_STM32_CAN_ENABLED
|
||||
# endif // HAL_CAN_MODULE_ENABLED
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
#include <sta/can_bus/controller.hpp>
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
#ifdef STA_STM32_CAN_ENABLED
|
||||
|
||||
#include <sta/can/controller.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
@@ -124,6 +124,6 @@ namespace sta
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_STM32_CAN_ENABLE
|
||||
#endif // STA_STM32_CAN_ENABLED
|
||||
|
||||
#endif // STA_CORE_STM32_CAN_HPP
|
||||
|
@@ -23,7 +23,10 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
// Only enable module on STM32 platform
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
|
||||
@@ -96,4 +99,6 @@
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
#endif // STA_CORE_STM32_CLOCKS_HPP
|
||||
|
@@ -12,14 +12,6 @@
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/**
|
||||
* @def STA_STM32_DELAY_ENABLE
|
||||
* @brief Enable module.
|
||||
*
|
||||
* @ingroup stm32BuildConfig
|
||||
*/
|
||||
# define STA_STM32_DELAY_ENABLE
|
||||
|
||||
/**
|
||||
* @def STA_STM32_DELAY_US_TIM
|
||||
* @brief 1 MHz TIM instance used by sta::delayUs.
|
||||
@@ -33,8 +25,9 @@
|
||||
#endif // DOXYGEN
|
||||
|
||||
|
||||
// Only enable module on STM32 platform
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STM32_DELAY_ENABLE
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -63,6 +56,6 @@ namespace sta
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_STM32_DELAY_ENABLE
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
#endif // STA_CORE_STM32_DELAY_HPP
|
||||
|
@@ -22,12 +22,20 @@
|
||||
#endif // DOXYGEN
|
||||
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL GPIO module enabled
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STM32_GPIO_ENABLE
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
# include <sta/stm32/hal.hpp>
|
||||
# ifdef HAL_GPIO_MODULE_ENABLED
|
||||
# define STA_STM32_GPIO_ENABLED
|
||||
# endif // HAL_GPIO_MODULE_ENABLED
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
|
||||
#ifdef STA_STM32_GPIO_ENABLED
|
||||
|
||||
#include <sta/gpio_pin.hpp>
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
@@ -103,6 +111,6 @@ namespace sta
|
||||
#define STA_STM32_GPIO_PIN(label) sta::STM32GpioPin{label##_GPIO_Port, label##_Pin}
|
||||
|
||||
|
||||
#endif // STA_STM32_GPIO_ENABLE
|
||||
#endif // STA_STM32_GPIO_ENABLED
|
||||
|
||||
#endif // STA_CORE_STM32_GPIO_PIN_HPP
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#ifndef STA_CORE_STM32_HAL_HPP
|
||||
#define STA_CORE_STM32_HAL_HPP
|
||||
|
||||
|
||||
// Include STM32 HAL headers
|
||||
#include <main.h>
|
||||
|
||||
|
@@ -11,26 +11,21 @@
|
||||
* @brief STM32 SPI module.
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/**
|
||||
* @def STA_STM32_SPI_ENABLE
|
||||
* @brief Enable module.
|
||||
*
|
||||
* Requires **STM_GPIO** module.
|
||||
*
|
||||
* @ingroup stm32BuildConfig
|
||||
*/
|
||||
# define STA_STM32_SPI_ENABLE
|
||||
#endif // DOXYGEN
|
||||
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL SPI module enabled
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STM32_SPI_ENABLE
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
# include <sta/stm32/hal.hpp>
|
||||
# ifndef HAL_GPIO_MODULE_ENABLED
|
||||
# error "STM32 GPIO module required!"
|
||||
# endif // !HAL_GPIO_MODULE_ENABLED
|
||||
# ifdef HAL_SPI_MODULE_ENABLED
|
||||
# define STA_STM32_SPI_ENABLED
|
||||
# endif // HAL_SPI_MODULE_ENABLED
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
#ifndef STA_STM32_GPIO_ENABLE
|
||||
#error "STM32 GPIO module required"
|
||||
#endif // !STA_STM32_GPIO_ENABLE
|
||||
|
||||
#ifdef STA_STM32_SPI_ENABLED
|
||||
|
||||
#include <sta/spi/device.hpp>
|
||||
#include <sta/spi/interface.hpp>
|
||||
@@ -128,6 +123,6 @@ namespace sta
|
||||
#define STA_STM32_SPI_INFO(handle) sta::STM32SpiInterfaceInfo{&handle, STA_STM32_GET_HANDLE_PCLK_FREQ_FN(handle)}
|
||||
|
||||
|
||||
#endif // STA_STM32_SPI_ENABLE
|
||||
#endif // STA_STM32_SPI_ENABLED
|
||||
|
||||
#endif // STA_CORE_STM32_SPI_HPP
|
||||
|
@@ -12,14 +12,6 @@
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/**
|
||||
* @def STA_STM32_UART_ENABLE
|
||||
* @brief Enable module.
|
||||
*
|
||||
* @ingroup stm32BuildConfig
|
||||
*/
|
||||
# define STA_STM32_UART_ENABLE
|
||||
|
||||
/**
|
||||
* @def STA_STM32_UART_DEBUG_SERIAL
|
||||
* @brief Create global sta::DebugSerial object using this HAL UART instance.
|
||||
@@ -30,13 +22,20 @@
|
||||
#endif // DOXYGEN
|
||||
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL UART module enabled
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STM32_UART_ENABLE
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
# include <sta/stm32/hal.hpp>
|
||||
# ifdef HAL_UART_MODULE_ENABLED
|
||||
# define STA_STM32_UART_ENABLED
|
||||
# endif // HAL_UART_MODULE_ENABLED
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
|
||||
#ifdef STA_STM32_UART_ENABLED
|
||||
|
||||
#include <sta/uart.hpp>
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
@@ -61,6 +60,6 @@ namespace sta
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_STM32_UART_ENABLE
|
||||
#endif // STA_STM32_UART_ENABLED
|
||||
|
||||
#endif // STA_CORE_STM32_UART_HPP
|
||||
|
Reference in New Issue
Block a user