mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-14 02:06:00 +00:00
46 lines
849 B
C++
46 lines
849 B
C++
/**
|
|
* @brief Implementation of UART using HAL.
|
|
*
|
|
* Define **STA_HAL_UART_ENABLE** in `<sta/config.hpp>` to enable module.
|
|
*
|
|
* To use a HAL UART instance (e.g. UART1) for `<sta/debug_serial.hpp>` define:
|
|
* #define STA_HAL_UART_DEBUG_SERIAL huart1
|
|
*/
|
|
#ifndef STA_HAL_UART_HPP
|
|
#define STA_HAL_UART_HPP
|
|
|
|
#include <sta/config.hpp>
|
|
#ifdef STA_HAL_UART_ENABLE
|
|
|
|
#include <sta/uart.hpp>
|
|
|
|
#include <main.h>
|
|
|
|
|
|
namespace sta
|
|
{
|
|
/**
|
|
* @brief Implementation of `UART` interface using HAL.
|
|
*/
|
|
class HalUART : public UART
|
|
{
|
|
public:
|
|
/**
|
|
* @param handle UART handle
|
|
*/
|
|
HalUART(UART_HandleTypeDef * handle);
|
|
|
|
using UART::print;
|
|
|
|
void write(const uint8_t * buffer, size_t size) override;
|
|
|
|
private:
|
|
UART_HandleTypeDef * handle_; /**< UART handle */
|
|
};
|
|
} // namespace sta
|
|
|
|
|
|
#endif // STA_HAL_UART_ENABLE
|
|
|
|
#endif // STA_HAL_UART_HPP
|