SPQR-Team1-2020/include/data_source.h

43 lines
759 B
C
Raw Normal View History

#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();
DataSource(HardwareSerial*, int);
2019-11-27 17:17:18 +01:00
DataSource(TwoWire* , int);
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 {
P_NULL,
2019-11-18 14:37:55 +01:00
P_I2C,
P_RXTX,
P_APIN,
P_DPIN
2019-11-18 14:37:55 +01:00
};
HardwareSerial* ser;
2019-10-21 08:57:58 +02:00
TwoWire* i2c;
int i2CAddr;
2019-10-21 08:57:58 +02: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
};