Contributing
To add more protocols to your project, follow these steps:
Create a New Protocol File : Create a header file for the new protocol, e.g., xyz_protocol.h.
Define Protocol Structure : Define constants, data structures, and functions.
Implement Protocol Functions : Implement functions in a corresponding source file (xyz_protocol.cpp).
Include Protocol Header : Include the header file using #include “xyz_protocol.h”.
Initialize Protocol : Initialize the protocol in your code.
Process Incoming Data : Call the function to process data.
Extract Channel Information : Extract channel data using the provided function.
Basic Functions Required
For a new protocol, implement these basic functions:
void begin() : Initialize the protocol.
void processIncoming() : Process incoming data.
void getChannels() : Extract channel information.
Here is a template for a new protocol header:
#pragma once
#ifndef XYZ_PROTOCOL_H
#define XYZ_PROTOCOL_H
#include <Arduino.h>
class XYZProtocol : public SerialIO {
public:
explicit XYZProtocol(HardwareSerial &rxPort, int rxPin, int txPin, bool inverted = false)
: SerialIO(&rxPort, rxPin, txPin, inverted) {}
~XYZProtocol();
void begin();
void processIncoming();
void getChannel();
private:
HardwareSerial *_serialPort;
};
#endif // XYZ_PROTOCOL_H