spm4648.h 625 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef Spm4648_h
  2. #define Spm4648_h
  3. #include "Arduino.h"
  4. #define CHANNELS 10
  5. #define MINVAL 306
  6. #define MAXVAL 1738
  7. #define MAXSTEP ((MAXVAL-MINVAL) / 10)
  8. class Spm4648 {
  9. public:
  10. Spm4648(void);
  11. void read(Stream &port);
  12. float getVal(byte x);
  13. void listVal();
  14. bool hasData();
  15. bool isConnected();
  16. float data[5];
  17. uint8_t ids[CHANNELS];
  18. uint16_t vals[CHANNELS];
  19. uint8_t idCount = 0;
  20. bool newData;
  21. private:
  22. void parse();
  23. void setVal(byte x, uint16_t val);
  24. uint8_t p = 0;
  25. uint32_t timeout;
  26. static const char length = 16;
  27. uint8_t buf[length];
  28. };
  29. #endif