Preliminary main mbed library for nexpaq development
libraries/tests/peripherals/TMP102/TMP102.h@1:d96dbedaebdb, 2016-11-04 (annotated)
- Committer:
- nexpaq
- Date:
- Fri Nov 04 20:54:50 2016 +0000
- Revision:
- 1:d96dbedaebdb
- Parent:
- 0:6c56fb4bc5f0
Removed extra directories for other platforms
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 0:6c56fb4bc5f0 | 1 | #ifndef TMP102_H |
nexpaq | 0:6c56fb4bc5f0 | 2 | #define TMP102_H |
nexpaq | 0:6c56fb4bc5f0 | 3 | |
nexpaq | 0:6c56fb4bc5f0 | 4 | #include "mbed.h" |
nexpaq | 0:6c56fb4bc5f0 | 5 | |
nexpaq | 0:6c56fb4bc5f0 | 6 | //!Library for the TI TMP102 temperature sensor. |
nexpaq | 0:6c56fb4bc5f0 | 7 | /*! |
nexpaq | 0:6c56fb4bc5f0 | 8 | The TMP102 is an I2C digital temperature sensor in a small SOT563 package, with a 0.0625C resolution and 0.5C accuracy. |
nexpaq | 0:6c56fb4bc5f0 | 9 | */ |
nexpaq | 0:6c56fb4bc5f0 | 10 | class TMP102 |
nexpaq | 0:6c56fb4bc5f0 | 11 | { |
nexpaq | 0:6c56fb4bc5f0 | 12 | public: |
nexpaq | 0:6c56fb4bc5f0 | 13 | //!Creates an instance of the class. |
nexpaq | 0:6c56fb4bc5f0 | 14 | /*! |
nexpaq | 0:6c56fb4bc5f0 | 15 | Connect module at I2C address addr using I2C port pins sda and scl. |
nexpaq | 0:6c56fb4bc5f0 | 16 | TMP102 |
nexpaq | 0:6c56fb4bc5f0 | 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> |
nexpaq | 0:6c56fb4bc5f0 | 18 | */ |
nexpaq | 0:6c56fb4bc5f0 | 19 | TMP102(PinName sda, PinName scl, int addr); |
nexpaq | 0:6c56fb4bc5f0 | 20 | |
nexpaq | 0:6c56fb4bc5f0 | 21 | /*! |
nexpaq | 0:6c56fb4bc5f0 | 22 | Destroys instance. |
nexpaq | 0:6c56fb4bc5f0 | 23 | */ |
nexpaq | 0:6c56fb4bc5f0 | 24 | ~TMP102(); |
nexpaq | 0:6c56fb4bc5f0 | 25 | |
nexpaq | 0:6c56fb4bc5f0 | 26 | //!Reads the current temperature. |
nexpaq | 0:6c56fb4bc5f0 | 27 | /*! |
nexpaq | 0:6c56fb4bc5f0 | 28 | Reads the temperature register of the TMP102 and converts it to a useable value. |
nexpaq | 0:6c56fb4bc5f0 | 29 | */ |
nexpaq | 0:6c56fb4bc5f0 | 30 | float read(); |
nexpaq | 0:6c56fb4bc5f0 | 31 | |
nexpaq | 0:6c56fb4bc5f0 | 32 | I2C m_i2c; |
nexpaq | 0:6c56fb4bc5f0 | 33 | |
nexpaq | 0:6c56fb4bc5f0 | 34 | private: |
nexpaq | 0:6c56fb4bc5f0 | 35 | int m_addr; |
nexpaq | 0:6c56fb4bc5f0 | 36 | |
nexpaq | 0:6c56fb4bc5f0 | 37 | }; |
nexpaq | 0:6c56fb4bc5f0 | 38 | |
nexpaq | 0:6c56fb4bc5f0 | 39 | #endif |