mbed-os

Fork of mbed-os by erkin yucel

Committer:
xuaner
Date:
Thu Jul 20 14:26:57 2017 +0000
Revision:
1:3deb71413561
Parent:
0:f269e3021894
mbed_os

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 #ifndef TMP102_H
elessair 0:f269e3021894 2 #define TMP102_H
elessair 0:f269e3021894 3
elessair 0:f269e3021894 4 #include "mbed.h"
elessair 0:f269e3021894 5
elessair 0:f269e3021894 6 //!Library for the TI TMP102 temperature sensor.
elessair 0:f269e3021894 7 /*!
elessair 0:f269e3021894 8 The TMP102 is an I2C digital temperature sensor in a small SOT563 package, with a 0.0625C resolution and 0.5C accuracy.
elessair 0:f269e3021894 9 */
elessair 0:f269e3021894 10 class TMP102
elessair 0:f269e3021894 11 {
elessair 0:f269e3021894 12 public:
elessair 0:f269e3021894 13 //!Creates an instance of the class.
elessair 0:f269e3021894 14 /*!
elessair 0:f269e3021894 15 Connect module at I2C address addr using I2C port pins sda and scl.
elessair 0:f269e3021894 16 TMP102
elessair 0:f269e3021894 17 \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>
elessair 0:f269e3021894 18 */
elessair 0:f269e3021894 19 TMP102(PinName sda, PinName scl, int addr);
elessair 0:f269e3021894 20
elessair 0:f269e3021894 21 /*!
elessair 0:f269e3021894 22 Destroys instance.
elessair 0:f269e3021894 23 */
elessair 0:f269e3021894 24 ~TMP102();
elessair 0:f269e3021894 25
elessair 0:f269e3021894 26 //!Reads the current temperature.
elessair 0:f269e3021894 27 /*!
elessair 0:f269e3021894 28 Reads the temperature register of the TMP102 and converts it to a useable value.
elessair 0:f269e3021894 29 */
elessair 0:f269e3021894 30 float read();
elessair 0:f269e3021894 31
elessair 0:f269e3021894 32 I2C m_i2c;
elessair 0:f269e3021894 33
elessair 0:f269e3021894 34 private:
elessair 0:f269e3021894 35 int m_addr;
elessair 0:f269e3021894 36
elessair 0:f269e3021894 37 };
elessair 0:f269e3021894 38
elessair 0:f269e3021894 39 #endif