2019-11-11 22:26:34 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-10-21 08:06:37 +02:00
|
|
|
#include "Wire.h"
|
|
|
|
#include "Arduino.h"
|
|
|
|
#include "HardwareSerial.h"
|
2019-10-21 08:57:58 +02:00
|
|
|
#include "vars.h"
|
2019-10-21 08:06:37 +02:00
|
|
|
|
|
|
|
class DataSource {
|
2019-10-21 08:57:58 +02:00
|
|
|
|
2019-10-21 08:06:37 +02:00
|
|
|
public:
|
2019-10-21 08:57:58 +02:00
|
|
|
DataSource();
|
2019-11-18 15:07:46 +01:00
|
|
|
DataSource(HardwareSerial*, int);
|
|
|
|
DataSource(TwoWire*);
|
2019-10-21 08:57:58 +02:00
|
|
|
DataSource(int, bool);
|
|
|
|
|
2019-10-21 08:06:37 +02:00
|
|
|
public:
|
2019-11-18 14:37:55 +01:00
|
|
|
virtual void update();
|
|
|
|
virtual void test();
|
|
|
|
virtual void readSensor();
|
|
|
|
virtual void postProcess();
|
|
|
|
virtual int getValue();
|
2019-10-21 08:06:37 +02:00
|
|
|
|
2019-10-21 08:57:58 +02:00
|
|
|
|
|
|
|
public:
|
2019-11-18 14:37:55 +01:00
|
|
|
enum Protocols {
|
2019-11-18 15:07:46 +01:00
|
|
|
P_NULL,
|
2019-11-18 14:37:55 +01:00
|
|
|
P_I2C,
|
|
|
|
P_RXTX,
|
|
|
|
P_APIN,
|
2019-11-18 15:07:46 +01:00
|
|
|
P_DPIN
|
2019-11-18 14:37:55 +01:00
|
|
|
};
|
|
|
|
|
2019-11-18 15:07:46 +01:00
|
|
|
HardwareSerial* ser;
|
2019-10-21 08:57:58 +02:00
|
|
|
TwoWire* i2c;
|
|
|
|
|
2019-11-18 15:07:46 +01:00
|
|
|
Protocols protocol;
|
2019-10-21 08:57:58 +02:00
|
|
|
int pin;
|
|
|
|
int value;
|
|
|
|
|
|
|
|
|
2019-11-18 14:37:55 +01:00
|
|
|
|
2019-10-21 08:06:37 +02:00
|
|
|
};
|