Keyboard firmwares for Atmel AVR and Cortex-M
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.

TMP102.h 887B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef TMP102_H
  2. #define TMP102_H
  3. #include "mbed.h"
  4. //!Library for the TI TMP102 temperature sensor.
  5. /*!
  6. The TMP102 is an I2C digital temperature sensor in a small SOT563 package, with a 0.0625C resolution and 0.5C accuracy.
  7. */
  8. class TMP102
  9. {
  10. public:
  11. //!Creates an instance of the class.
  12. /*!
  13. Connect module at I2C address addr using I2C port pins sda and scl.
  14. TMP102
  15. \param addr <table><tr><th>A0 pin connection</th><th>Address</th></tr><tr><td>GND</td><td>0x90</td></tr><tr><td>V+</td><td>0x92</td></tr><tr><td>SDA</td><td>0x94</td></tr><tr><td>SCL</td><td>0x96</td></tr></table>
  16. */
  17. TMP102(PinName sda, PinName scl, int addr);
  18. /*!
  19. Destroys instance.
  20. */
  21. ~TMP102();
  22. //!Reads the current temperature.
  23. /*!
  24. Reads the temperature register of the TMP102 and converts it to a useable value.
  25. */
  26. float read();
  27. I2C m_i2c;
  28. private:
  29. int m_addr;
  30. };
  31. #endif