33 # include <HardwareSerial.h> 64 : m_buffer( (uint8_t *)buffer )
65 , m_bufferSize( bufferSize )
100 begin([](
void *p,
const void *b,
int s)->
int {
return Serial.write((
const uint8_t *)b, s); },
101 [](
void *p,
void *b,
int s)->
int {
return Serial.readBytes((uint8_t *)b, s); });
104 #ifdef HAVE_HWSERIAL1 112 begin([](
void *p,
const void *b,
int s)->
int {
return Serial1.write((
const uint8_t *)b, s); },
113 [](
void *p,
void *b,
int s)->
int {
return Serial1.readBytes((uint8_t *)b, s); });
117 #ifdef HAVE_HWSERIAL2 125 begin([](
void *p,
const void *b,
int s)->
int {
return Serial2.write((
const uint8_t *)b, s); },
126 [](
void *p,
void *b,
int s)->
int {
return Serial2.readBytes((uint8_t *)b, s); });
130 #ifdef HAVE_HWSERIAL3 138 begin([](
void *p,
const void *b,
int s)->
int {
return Serial3.write((
const uint8_t *)b, s); },
139 [](
void *p,
void *b,
int s)->
int {
return Serial3.readBytes((uint8_t *)b, s); });
144 #ifdef HAVE_SERIALUSB 150 inline void beginToSerialUSB()
152 begin([](
void *p,
const void *b,
int s)->
int {
return SerialUSB.write((
const char *)b, s); },
153 [](
void *p,
void *b,
int s)->
int {
return SerialUSB.readBytes((
char *)b, s); });
172 int write(
char* buf,
int size);
192 int run_rx(uint16_t timeout = 0);
200 int run_rx(
const void *data,
int len);
206 int run_tx(uint16_t timeout = 0);
215 int run_tx(
void *data,
int max_size);
294 IPacket pkt((
char *)pdata, size);
296 if ( m_onReceive ) m_onReceive( pkt );
305 virtual void onSend(uint8_t *pdata,
int size)
307 IPacket pkt((
char *)pdata, size);
309 if ( m_onSend ) m_onSend( pkt );
317 uint8_t *m_buffer =
nullptr;
322 int m_bufferSize = 0;
325 uint16_t m_sendTimeout = 0;
328 uint8_t m_window = 3;
331 void (*m_onReceive)(
IPacket &pkt) =
nullptr;
334 void (*m_onSend)(
IPacket &pkt) =
nullptr;
337 static void onReceiveInternal(
void *handle, uint16_t uid, uint8_t *pdata,
int size);
340 static void onSendInternal(
void *handle, uint16_t uid, uint8_t *pdata,
int size);
int run_tx(uint16_t timeout=0)
+
hdlc_crc_t
Definition: tiny_hdlc.h:54
Tiny protocol Arduino API.
-
If default is specified HDLC will auto select CRC option.
Definition: tiny_hdlc.h:53
-
virtual void onSend(uint8_t *pdata, int size)
Definition: TinyProtocolFd.h:278
-
Definition: TinyProtocolFd.h:320
+
If default is specified HDLC will auto select CRC option.
Definition: tiny_hdlc.h:56
+
virtual void onSend(uint8_t *pdata, int size)
Definition: TinyProtocolFd.h:305
+
Definition: TinyProtocolFd.h:347
Definition: TinyLightProtocol.h:39
void enableCrc(hdlc_crc_t crc)
struct tiny_fd_data_t * tiny_fd_handle_t
Definition: tiny_fd.h:50
-
void setReceiveCallback(void(*on_receive)(IPacket &pkt)=nullptr)
Definition: TinyProtocolFd.h:236
-
virtual void onReceive(uint8_t *pdata, int size)
Definition: TinyProtocolFd.h:265
+
void setReceiveCallback(void(*on_receive)(IPacket &pkt)=nullptr)
Definition: TinyProtocolFd.h:263
+
virtual void onReceive(uint8_t *pdata, int size)
Definition: TinyProtocolFd.h:292
-
int(* read_block_cb_t)(void *pdata, void *buffer, int size)
Definition: tiny_types.h:139
+
int(* read_block_cb_t)(void *pdata, void *buffer, int size)
Definition: tiny_types.h:141
IProtoFd(void *buffer, int bufferSize)
Definition: TinyProtocolFd.h:62
-
void beginToSerial3()
Definition: TinyProtocolFd.h:126
-
void setWindowSize(uint8_t window)
Definition: TinyProtocolFd.h:250
+
void beginToSerial3()
Definition: TinyProtocolFd.h:136
+
void setWindowSize(uint8_t window)
Definition: TinyProtocolFd.h:277
Definition: TinyPacket.h:46
-
void beginToSerial2()
Definition: TinyProtocolFd.h:113
+
void beginToSerial2()
Definition: TinyProtocolFd.h:123
Definition: TinyProtocolFd.h:53
int run_rx(uint16_t timeout=0)
-
int(* write_block_cb_t)(void *pdata, const void *buffer, int size)
Definition: tiny_types.h:128
-
void beginToSerial()
Definition: TinyProtocolFd.h:88
-
Definition: TinyProtocolFd.h:333
+
int(* write_block_cb_t)(void *pdata, const void *buffer, int size)
Definition: tiny_types.h:130
+
void beginToSerial()
Definition: TinyProtocolFd.h:98
+
Definition: TinyProtocolFd.h:360
Tiny Protocol Full Duplex API.
-
void beginToSerial1()
Definition: TinyProtocolFd.h:100
-
ProtoFdD(int size)
Definition: TinyProtocolFd.h:340
-
void setSendCallback(void(*on_send)(IPacket &pkt)=nullptr)
Definition: TinyProtocolFd.h:242
-
void setSendTimeout(uint16_t timeout)
Definition: TinyProtocolFd.h:256
-
void begin(write_block_cb_t writecb, read_block_cb_t readcb)
+
void beginToSerial1()
Definition: TinyProtocolFd.h:110
+
ProtoFdD(int size)
Definition: TinyProtocolFd.h:367
+
void setSendCallback(void(*on_send)(IPacket &pkt)=nullptr)
Definition: TinyProtocolFd.h:269
+
+
void setSendTimeout(uint16_t timeout)
Definition: TinyProtocolFd.h:283
int write(char *buf, int size)