mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-16 07:23:07 +01:00
use nonblocking write for serial
This commit is contained in:
24
lib/serial/GwSerial.h
Normal file
24
lib/serial/GwSerial.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _GWSERIAL_H
|
||||
#define _GWSERIAL_H
|
||||
#include "driver/uart.h"
|
||||
#include "GwLog.h"
|
||||
#include "GwBuffer.h"
|
||||
class SerialWriter;
|
||||
class GwSerial{
|
||||
private:
|
||||
GwBuffer *buffer;
|
||||
GwLog *logger;
|
||||
SerialWriter *writer;
|
||||
uart_port_t num;
|
||||
bool initialized=false;
|
||||
public:
|
||||
static const int bufferSize=200;
|
||||
GwSerial(GwLog *logger,uart_port_t num);
|
||||
~GwSerial();
|
||||
int setup(int baud,int rxpin,int txpin);
|
||||
bool isInitialized();
|
||||
size_t enqueue(const uint8_t *data, size_t len);
|
||||
GwBuffer::WriteStatus write();
|
||||
const char *read();
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user