Hello,
I am using the PacketSerial library that is located here:
I've come across the need to set a larger receive buffer size in the library, and am not clear on the proper syntax to use.
In the library, there is the following comment and "template" definition.
/// \brief A template class enabling packet-based Serial communication.
///
/// Typically one of the typedefined versions are used, for example,
/// `COBSPacketSerial` or `SLIPPacketSerial`.
///
/// The template parameters allow the user to define their own packet encoder /
/// decoder, custom packet marker and receive buffer size.
///
/// \tparam EncoderType The static packet encoder class name.
/// \tparam PacketMarker The byte value used to mark the packet boundary.
/// \tparam BufferSize The number of bytes allocated for the receive buffer.
template<typename EncoderType, uint8_t PacketMarker = 0, size_t BufferSize = 256>
class PacketSerial_
{
...
This seems to indicate that I should be able to provide these additional parameters someplace and specify a larger buffer. I'll admit that I'm just not familiar enough with these "template" definitions to understand how to use this.
Currently, in my code I'm just using:
PacketSerial myPacketSerial;
I've tried to add parameters to this with no luck.
Later in my code:
// Set-up the PacketSerial connection ...
Serial.print(F("Initializing PacketSerial ... "));
mySoftwareSerial.begin(PACKET_BAUD_RATE);
myPacketSerial.setStream(&mySoftwareSerial);
myPacketSerial.setPacketHandler(&onSerialPacketReceived);
Serial.println(F("done!"));
I've tried to read and understand how a "template" works ... but am having no luck in understanding this yet.
Any thoughts or comments?
Thanks in advance!