bakercp / PacketSerial

An Arduino Library that facilitates packet-based serial communication using COBS or SLIP encoding.
http://bakercp.github.io/PacketSerial/
MIT License
280 stars 59 forks source link

How to properly specify a larger buffer size? #22

Closed Humancell closed 5 years ago

Humancell commented 5 years ago

I've read in the code where I'm supposed to be able to set a larger buffer size:

https://github.com/bakercp/PacketSerial/blob/master/src/PacketSerial.h#L27

I'll admit that I'm not familiar with this template concept and am unable to figure out the proper syntax in my code with the constructor to include these parameters.

Do you have an example of how to provide these two parameters?

Humancell commented 5 years ago

I've been reading more and more about templates, and have tried both:

PacketSerial<0, 512> myPacketSerial;
error: 'PacketSerial' is not a template

COBSPacketSerial<0, 512> myPacketSerial;
error: 'COBSPacketSerial {aka PacketSerial_<COBS>}' is not a template

But neither of these work ...

Humancell commented 5 years ago

Ok ... so close.

I found this, and it works! The underscore and EncoderType I missed.

PacketSerial_<COBS, 0, 512> myPacketSerial;