Change module enable logic

This commit is contained in:
Henrik Stickann
2023-01-20 01:52:18 +01:00
parent 7f2f4a4df9
commit dd2983821e
12 changed files with 70 additions and 71 deletions

View File

@@ -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