mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
First reworks for debugging
This commit is contained in:
61
include/sta/devices/stm32/bus/uart.hpp
Normal file
61
include/sta/devices/stm32/bus/uart.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Implementation of UART using STM32 HAL.
|
||||
*/
|
||||
#ifndef STA_CORE_STM32_UART_HPP
|
||||
#define STA_CORE_STM32_UART_HPP
|
||||
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL UART module enabled
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
# include <sta/devices/stm32/hal.hpp>
|
||||
# ifdef HAL_UART_MODULE_ENABLED
|
||||
# define STA_STM32_UART_ENABLED
|
||||
# endif // HAL_UART_MODULE_ENABLED
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
|
||||
#if defined(STA_STM32_UART_ENABLED) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/bus/uart/uart.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_stm32_uart UART
|
||||
* @ingroup sta_core_stm32
|
||||
* @brief STM32 UART module.
|
||||
*/
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Implementation of UART interface using HAL.
|
||||
*
|
||||
* @ingroup sta_core_stm32_uart
|
||||
*/
|
||||
class STM32UART : public UART
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param handle STM32 HAL handle
|
||||
*/
|
||||
STM32UART(UART_HandleTypeDef * handle, Mutex * mutex);
|
||||
|
||||
void transfer(uint8_t value) override;
|
||||
void transfer16(uint16_t value) override;
|
||||
void transfer(const uint8_t * buffer, size_t size) override;
|
||||
void transfer(const uint8_t * txBuffer, uint8_t * rxBuffer, size_t size) override;
|
||||
void receive(uint8_t * buffer, size_t size) override;
|
||||
|
||||
void fill(uint8_t value, size_t count) override;
|
||||
private:
|
||||
UART_HandleTypeDef * handle_; /**< STM32 HAL handle */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_STM32_UART_ENABLED
|
||||
|
||||
#endif // STA_CORE_STM32_UART_HPP
|
Reference in New Issue
Block a user