2019-11-25 17:30:47 +01:00
|
|
|
#pragma once
|
|
|
|
#include "data_source.h"
|
|
|
|
|
2019-11-27 15:33:13 +01:00
|
|
|
#define US_WAIT_TIME 70
|
|
|
|
|
2019-11-25 17:30:47 +01:00
|
|
|
class DataSourceUS : public DataSource{
|
|
|
|
|
|
|
|
public:
|
2019-11-27 15:33:13 +01:00
|
|
|
DataSourceUS(TwoWire* i2c_, int addr);
|
2019-11-25 17:30:47 +01:00
|
|
|
void test() override;
|
2019-11-27 17:17:18 +01:00
|
|
|
void readSensor() override;
|
|
|
|
|
2019-11-25 17:30:47 +01:00
|
|
|
void usMode();
|
|
|
|
void usTrigger();
|
|
|
|
void usReceive();
|
|
|
|
|
|
|
|
int reading;
|
|
|
|
long us_t0;
|
|
|
|
long us_t1;
|
2019-11-27 17:17:18 +01:00
|
|
|
bool us_flag;
|
2019-11-25 17:30:47 +01:00
|
|
|
};
|