Merge pull request #73 from romoloman/master
[openXsensor.git] / openXsensor / oXs_curr.h
blob732efc0a57a0e57f170ca774db3cf0a4d6d11b3c
1 #ifndef OXS_CURRENT_h
2 #define OXS_CURRENT_h
4 #include <Arduino.h>
5 #include "oXs_config_basic.h"
6 #include "oXs_config_advanced.h"
7 #include "oXs_config_macros.h"
9 struct CURRENTDATA {
10 struct ONE_MEASUREMENT milliAmps; // in mA
11 struct ONE_MEASUREMENT consumedMilliAmps; // in mA
12 //int32_t consumedMilliAmps; // in mA
13 //bool consumedMilliAmpsAvailable;
18 class OXS_CURRENT {
19 public:
20 #ifdef DEBUG
21 OXS_CURRENT(uint8_t pinCurrent, HardwareSerial &print);
22 #else
23 OXS_CURRENT(uint8_t pinCurrent) ;
24 #endif
25 CURRENTDATA currentData ;
26 void setupCurrent() ;
27 void readSensor();
28 void resetValues();
30 private:
31 #ifdef DEBUG
32 HardwareSerial* printer;
33 #endif
34 byte _pinCurrent;
35 float offsetCurrentSteps ;
36 float mAmpPerStep ;
37 float floatConsumedMilliAmps; // in mA
38 int32_t sumCurrent ;
41 #endif // OXS_CURRENT_h