Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (44 sloc) 1.22 KB
#ifndef Messenger_h
#define Messenger_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "WProgram.h"
#include <inttypes.h>
extern "C" {
// callback function
typedef void (*messengerCallbackFunction)(void);
class Messenger
Messenger(char separator);
int readInt();
long readLong(); // Added based on a suggestion by G. Paolo Sani
char readChar();
double readDouble(); // Added based on a suggestion by Lorenzo C.
char* peek();
void copyString(char *string, uint8_t size);
uint8_t checkString(const char *string);
uint8_t process(int serialByte);
uint8_t available();
void attach(messengerCallbackFunction newFunction);
void init(char separator);
uint8_t next();
void reset();
uint8_t messageState;
messengerCallbackFunction callback;
char* current; // Pointer to current data
char* last;
char token[2];
uint8_t dumped;
uint8_t bufferIndex; // Index where to write the data
char buffer[MESSENGERBUFFERSIZE]; // Buffer that holds the data
uint8_t bufferLength; // The length of the buffer (defaults to 64)
uint8_t bufferLastIndex; // The last index of the buffer