28 #ifndef _TINY_PROTOCOL_H_ 29 #define _TINY_PROTOCOL_H_ 35 # include <HardwareSerial.h> 69 void (*onReceive)(uint8_t *buf,
int len))
73 m_bufferSize = bufferSize;
74 m_onReceive = onReceive;
96 begin([](
void *p,
const void *b,
int s)->
int {
return Serial.write((
const uint8_t *)b, s); },
97 [](
void *p,
void *b,
int s)->
int {
return Serial.readBytes((uint8_t *)b, s); });
100 #ifdef HAVE_HWSERIAL1 108 begin([](
void *p,
const void *b,
int s)->
int {
return Serial1.write((
const uint8_t *)b, s); },
109 [](
void *p,
void *b,
int s)->
int {
return Serial1.readBytes((uint8_t *)b, s); });
113 #ifdef HAVE_HWSERIAL2 121 begin([](
void *p,
const void *b,
int s)->
int {
return Serial2.write((
const uint8_t *)b, s); },
122 [](
void *p,
void *b,
int s)->
int {
return Serial2.readBytes((uint8_t *)b, s); });
126 #ifdef HAVE_HWSERIAL3 134 begin([](
void *p,
const void *b,
int s)->
int {
return Serial3.write((
const uint8_t *)b, s); },
135 [](
void *p,
void *b,
int s)->
int {
return Serial3.readBytes((uint8_t *)b, s); });
140 #ifdef HAVE_SERIALUSB 146 inline void beginToSerialUSB()
148 begin([](
void *p,
const void *b,
int s)->
int {
return SerialUSB.write((
const char *)b, s); },
149 [](
void *p,
void *b,
int s)->
int {
return SerialUSB.readBytes((
char *)b, s); });
168 int write (
char* buf,
int size);
232 void (*m_onReceive)(uint8_t *buf,
int len);
234 static void onReceiveInternal(
void *handle, uint16_t uid, uint8_t *pdata,
int size);
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:56
Definition: TinyLightProtocol.h:39
void begin(write_block_cb_t writecb, read_block_cb_t readcb)
void beginToSerial()
Definition: TinyProtocolHd.h:94
Definition: TinyProtocolHd.h:54
ProtoHd(void *buffer, int bufferSize, void(*onReceive)(uint8_t *buf, int len))
Definition: TinyProtocolHd.h:67
void beginToSerial1()
Definition: TinyProtocolHd.h:106
int write(char *buf, int size)
int(* read_block_cb_t)(void *pdata, void *buffer, int size)
Definition: tiny_types.h:141
void beginToSerial2()
Definition: TinyProtocolHd.h:119
void beginToSerial3()
Definition: TinyProtocolHd.h:132
Tiny Protocol Half Duplex API.
Definition: TinyPacket.h:46
int(* write_block_cb_t)(void *pdata, const void *buffer, int size)
Definition: tiny_types.h:130