ES ordening

This commit is contained in:
Rens Pastoor
2025-05-27 23:20:05 +02:00
parent d9244f1ae3
commit 39269a71a7
49 changed files with 1952 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
#include <Arduino.h>
#ifndef SERIALPROCESS_H
#define SERIALPROCESS_H
class SerialProcess {
private:
uint8_t ndx; // Current index for the buffer
const char beginMarker = '#'; // Marker to indicate the start of a message
const char endMarker = ';'; // Marker to indicate the end of a message
char rc; // Character read from Serial
int address; // Device address
bool newData; // Flag for new data availability
static const uint8_t numChars = 255; // Maximum size of the buffer
char receivedChars[numChars]; // Buffer for incoming data
bool rcCheck;
public:
// Constructor
explicit SerialProcess(int addr);
// Store Serial Input (if available)
void SerialInput();
// Check if new data is available
bool isNewDataAvailable();
// Get the received data
char* getReceivedData();
// Process the received message
void getPayload(char* payload);
// Send message in the correct format
void sendMessage(int receiver, const char* payload);
void changeAddress(int addr);
};
#endif // SERIALPROCESS_H