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.

IAQ2000.h 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // I2Cdev library collection - iAQ-2000 I2C device class header file
  2. // Based on AppliedSensor iAQ-2000 Interface Description, Version PA1, 2009
  3. // 2012-04-01 by Peteris Skorovs <pskorovs@gmail.com>
  4. //
  5. // This I2C device library is using (and submitted as a part of) Jeff Rowberg's I2Cdevlib library,
  6. // which should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
  7. //
  8. // Changelog:
  9. // 2012-04-01 - initial release
  10. // 2015-11-08 - added TVoc and Status
  11. /* ============================================
  12. I2Cdev device library code is placed under the MIT license
  13. Copyright (c) 2012 Peteris Skorovs, Jeff Rowberg
  14. Permission is hereby granted, free of charge, to any person obtaining a copy
  15. of this software and associated documentation files (the "Software"), to deal
  16. in the Software without restriction, including without limitation the rights
  17. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18. copies of the Software, and to permit persons to whom the Software is
  19. furnished to do so, subject to the following conditions:
  20. The above copyright notice and this permission notice shall be included in
  21. all copies or substantial portions of the Software.
  22. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  25. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  27. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  28. THE SOFTWARE.
  29. ===============================================
  30. */
  31. #ifndef _IAQ2000_H_
  32. #define _IAQ2000_H_
  33. #include "I2Cdev.h"
  34. #define IAQ2000_ADDRESS 0x5A
  35. #define IAQ2000_DEFAULT_ADDRESS IAQ2000_ADDRESS
  36. #define IAQ2000_RA_DATA1 0x00
  37. #define IAQ2000_RA_DATA2 0x01
  38. class IAQ2000 {
  39. public:
  40. IAQ2000();
  41. IAQ2000(uint8_t address);
  42. void initialize();
  43. bool testConnection();
  44. uint16_t getIaqtvoc();
  45. uint16_t getIaqpred();
  46. uint8_t getIaqstatus();
  47. private:
  48. uint8_t devAddr;
  49. uint8_t buffer[8];
  50. int8_t readAllBytes(uint8_t devAddr, uint8_t length, uint8_t *data,
  51. uint16_t timeout = I2Cdev::readTimeout);
  52. };
  53. #endif /* _IAQ200_H_ */