14#include <circle/sched/task.h>
15#include <circle/spinlock.h>
16#include <circle/serial.h>
56 bool Initialize(CInterruptSystem *pInterruptSystem,
ReceiveHandler recvFunc);
73 void Send(
const char* buf,
size_t len);
90 class CSerialDeviceWithAccess :
public CSerialDevice
93 using CSerialDevice::CSerialDevice;
94 unsigned RxAvailable() {
return AvailableForRead(); }
97 CSerialDeviceWithAccess *m_pSerial =
nullptr;
98 CInterruptSystem *m_pInterruptSystem =
nullptr;
99 bool m_bTaskRunning =
false;
100 bool m_bEverStarted =
false;
101 bool m_bSoftwareFlowControl =
false;
102 bool m_bFlowStopped =
false;
103 unsigned m_FlowHighThreshold = 0;
104 unsigned m_FlowLowThreshold = 0;
Task responsible for UART initialization and data retrieval.
Definition TUART.h:34
void Send(const char *buf, size_t len)
Send a message through the serial interface.
Definition TUART.cpp:152
void(* ReceiveHandler)(const char *, size_t)
Initialize the serial port.
Definition TUART.h:55
CTUART()
Construct a CTUART task object.
Definition TUART.cpp:35
void Run() override
Main task loop for UART (currently idle, extend for polling/interrupt).
Definition TUART.cpp:158
int DrainSerialInput(char *dest, size_t maxLen)
Drain available serial input from the ring buffer into a destination buffer.
Definition TUART.cpp:167
static CTUART * Get(void)
Access the singleton UART task instance.
Definition TUART.cpp:25
~CTUART()
Destructor for CUART.
Definition TUART.cpp:51
void SuspendTask()
Suspend the UART task so host input is buffered only.
Definition TUART.cpp:140
bool EnsureStarted()
Ensure the UART task is running; safe to call multiple times.
Definition TUART.cpp:111