mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
/**
|
|
* @file
|
|
* @brief Printable UART interface definition.
|
|
*/
|
|
#ifndef STA_CORE_PRINTABLE_UART_HPP
|
|
#define STA_CORE_PRINTABLE_UART_HPP
|
|
|
|
#include <sta/bus/uart/uart.hpp>
|
|
#include <sta/debug/printing/printable.hpp>
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
|
|
namespace sta
|
|
{
|
|
/**
|
|
* @brief Printable interface for UART.
|
|
*
|
|
* @ingroup sta_core
|
|
*/
|
|
class PrintableUART : public Printable
|
|
{
|
|
public:
|
|
/**
|
|
* @param intf UART instance
|
|
*/
|
|
PrintableUART(UART * intf);
|
|
|
|
/**
|
|
* @brief Print string.
|
|
*
|
|
* @param str String buffer
|
|
* @param length String length
|
|
* @param newline If true, send a \r\n to start a new line.
|
|
*/
|
|
void print(const char * str, size_t length, bool newline = false) override;
|
|
|
|
/**
|
|
* @brief Read string.
|
|
*
|
|
* @param str String buffer
|
|
* @param length String length
|
|
*/
|
|
void read(char * str, size_t length) override;
|
|
|
|
private:
|
|
UART * intf_;
|
|
};
|
|
} // namespace sta
|
|
|
|
|
|
#endif // STA_CORE_PRINTABLE_UART_HPP
|