This commit is contained in:
Nick Leeman 2021-04-04 00:01:06 +02:00
parent 69f48d65cd
commit 057cce2096
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "SimpleSerialProtocol", "name": "SimpleSerialProtocol",
"version": "1.2.0", "version": "1.3.0",
"description": "Easy-to-use serial protocol system for arduino type devices.", "description": "Easy-to-use serial protocol system for arduino type devices.",
"keywords": "Serial, Connectivity, USB, Simple", "keywords": "Serial, Connectivity, USB, Simple",
"repository": "repository":

View File

@ -21,9 +21,9 @@
class SerialConnection class SerialConnection
{ {
private: private:
byte serialBufferSize = 300; int serialBufferSize = 1024;
char serialBuffer[300]; char serialBuffer[1024];
char serialData[300] = {0}; char serialData[1024] = {0};
const char packetStartMarker = '<'; const char packetStartMarker = '<';
const char packetEndMarker = '>'; const char packetEndMarker = '>';
@ -55,20 +55,26 @@ void SerialConnection::init(int serialIndex, unsigned long serialBaud) {
serialRefrence = &Serial; serialRefrence = &Serial;
} }
#ifdef Serial1
else if (serialIndex == 1) { else if (serialIndex == 1) {
Serial1.begin(serialBaud); Serial1.begin(serialBaud);
serialRefrence = &Serial1; serialRefrence = &Serial1;
} }
#endif
#ifdef Serial2
else if (serialIndex == 2) { else if (serialIndex == 2) {
Serial2.begin(serialBaud); Serial2.begin(serialBaud);
serialRefrence = &Serial2; serialRefrence = &Serial2;
} }
#endif
#ifdef Serial3
else if (serialIndex == 3) { else if (serialIndex == 3) {
Serial3.begin(serialBaud); Serial3.begin(serialBaud);
serialRefrence = &Serial3; serialRefrence = &Serial3;
} }
#endif
}; };
char* SerialConnection::handle() { char* SerialConnection::handle() {