mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-09-29 05:17:33 +00:00
Move STM32 related code to sta-stm32-core repo
This commit is contained in:
66
include/sta/stm32/uart.hpp
Normal file
66
include/sta/stm32/uart.hpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Implementation of UART using STM32 HAL.
|
||||
*/
|
||||
#ifndef STA_STM32_UART_HPP
|
||||
#define STA_STM32_UART_HPP
|
||||
|
||||
/**
|
||||
* @defgroup stm32UART UART
|
||||
* @ingroup stm32
|
||||
* @brief STM32 UART module.
|
||||
*/
|
||||
|
||||
#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.
|
||||
*
|
||||
* @ingroup stm32BuildConfig
|
||||
*/
|
||||
# define STA_STM32_UART_DEBUG_SERIAL
|
||||
#endif // DOXYGEN
|
||||
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STM32_UART_ENABLE
|
||||
|
||||
#include <sta/intf/uart.hpp>
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Implementation of UART interface using HAL.
|
||||
*
|
||||
* @ingroup stm32UART
|
||||
*/
|
||||
class STM32UART : public UART
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param handle UART handle
|
||||
*/
|
||||
STM32UART(UART_HandleTypeDef * handle);
|
||||
|
||||
void write(const uint8_t * buffer, size_t size) override;
|
||||
|
||||
private:
|
||||
UART_HandleTypeDef * handle_; /**< UART handle */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_STM32_UART_ENABLE
|
||||
|
||||
#endif // STA_STM32_UART_HPP
|
Reference in New Issue
Block a user