Dependencies:   dispBoB mbed PCA9635

Committer:
d_worrall
Date:
Fri Jul 08 15:14:55 2011 +0000
Revision:
0:ba39353df5e7
version1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
d_worrall 0:ba39353df5e7 1
d_worrall 0:ba39353df5e7 2 /*
d_worrall 0:ba39353df5e7 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
d_worrall 0:ba39353df5e7 4
d_worrall 0:ba39353df5e7 5 Permission is hereby granted, free of charge, to any person obtaining a copy
d_worrall 0:ba39353df5e7 6 of this software and associated documentation files (the "Software"), to deal
d_worrall 0:ba39353df5e7 7 in the Software without restriction, including without limitation the rights
d_worrall 0:ba39353df5e7 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
d_worrall 0:ba39353df5e7 9 copies of the Software, and to permit persons to whom the Software is
d_worrall 0:ba39353df5e7 10 furnished to do so, subject to the following conditions:
d_worrall 0:ba39353df5e7 11
d_worrall 0:ba39353df5e7 12 The above copyright notice and this permission notice shall be included in
d_worrall 0:ba39353df5e7 13 all copies or substantial portions of the Software.
d_worrall 0:ba39353df5e7 14
d_worrall 0:ba39353df5e7 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
d_worrall 0:ba39353df5e7 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
d_worrall 0:ba39353df5e7 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
d_worrall 0:ba39353df5e7 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
d_worrall 0:ba39353df5e7 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
d_worrall 0:ba39353df5e7 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
d_worrall 0:ba39353df5e7 21 THE SOFTWARE.
d_worrall 0:ba39353df5e7 22 */
d_worrall 0:ba39353df5e7 23
d_worrall 0:ba39353df5e7 24 #ifndef TMP102_H
d_worrall 0:ba39353df5e7 25 #define TMP102_H
d_worrall 0:ba39353df5e7 26
d_worrall 0:ba39353df5e7 27 #include "mbed.h"
d_worrall 0:ba39353df5e7 28
d_worrall 0:ba39353df5e7 29 //!Library for the TI TMP102 temperature sensor.
d_worrall 0:ba39353df5e7 30 /*!
d_worrall 0:ba39353df5e7 31 The TMP102 is an I2C digital temperature sensor in a small SOT563 package, with a 0.0625C resolution and 0.5C accuracy.
d_worrall 0:ba39353df5e7 32 */
d_worrall 0:ba39353df5e7 33 class TMP102
d_worrall 0:ba39353df5e7 34 {
d_worrall 0:ba39353df5e7 35 public:
d_worrall 0:ba39353df5e7 36 //!Creates an instance of the class.
d_worrall 0:ba39353df5e7 37 /*!
d_worrall 0:ba39353df5e7 38 Connect module at I2C address addr using I2C port pins sda and scl.
d_worrall 0:ba39353df5e7 39 TMP102
d_worrall 0:ba39353df5e7 40 \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>
d_worrall 0:ba39353df5e7 41 */
d_worrall 0:ba39353df5e7 42 TMP102(PinName sda, PinName scl, int addr);
d_worrall 0:ba39353df5e7 43
d_worrall 0:ba39353df5e7 44 /*!
d_worrall 0:ba39353df5e7 45 Destroys instance.
d_worrall 0:ba39353df5e7 46 */
d_worrall 0:ba39353df5e7 47 ~TMP102();
d_worrall 0:ba39353df5e7 48
d_worrall 0:ba39353df5e7 49 //!Reads the current temperature.
d_worrall 0:ba39353df5e7 50 /*!
d_worrall 0:ba39353df5e7 51 Reads the temperature register of the TMP102 and converts it to a useable value.
d_worrall 0:ba39353df5e7 52 */
d_worrall 0:ba39353df5e7 53 float read();
d_worrall 0:ba39353df5e7 54
d_worrall 0:ba39353df5e7 55 private:
d_worrall 0:ba39353df5e7 56 I2C m_i2c;
d_worrall 0:ba39353df5e7 57 int m_addr;
d_worrall 0:ba39353df5e7 58
d_worrall 0:ba39353df5e7 59 };
d_worrall 0:ba39353df5e7 60
d_worrall 0:ba39353df5e7 61 #endif