*
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <stm32h7xx_hal.h>
|
||||
#include <functional>
|
||||
|
||||
class UartReader {
|
||||
public:
|
||||
using LineCallback = std::function<void(const char*, std::size_t)>;
|
||||
|
||||
UartReader();
|
||||
void start(LineCallback lineCallback);
|
||||
void onDataRx();
|
||||
|
||||
private:
|
||||
static const int BufferSize = 128;
|
||||
LineCallback _lineCallback;
|
||||
std::uint8_t buffer0[BufferSize];
|
||||
std::uint8_t buffer1[BufferSize];
|
||||
std::uint8_t* _writeBuffer = buffer0;
|
||||
std::uint8_t* _readBuffer = buffer1;
|
||||
std::size_t _rxSize = 0;
|
||||
|
||||
//LF_TERMINAL_STREAM_USART
|
||||
};
|
||||
Reference in New Issue
Block a user