Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
641 B

  1. /*
  2. EmonLiteESP
  3. Energy Monitor Library for ESP8266 based on EmonLib
  4. Currently only support current sensing
  5. */
  6. #ifndef EmonLiteESP_h
  7. #define EmonLiteESP_h
  8. #define ADC_BITS 10
  9. #define ADC_COUNTS (1<<ADC_BITS)
  10. class EnergyMonitor {
  11. public:
  12. void initCurrent(unsigned int pin, double ref, double ratio);
  13. double getCurrent(unsigned int samples);
  14. byte getPrecision();
  15. void setPrecision(byte precision);
  16. private:
  17. unsigned int _currentPin;
  18. double _referenceVoltage;
  19. double _currentRatio;
  20. double _currentMidPoint;
  21. double _currentFactor;
  22. byte _precision;
  23. double _multiplier;
  24. };
  25. #endif