Ethernetwebsoc
Dependencies: C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip
LM75B/LM75B.h@0:0ed2a7c7190c, 2013-05-31 (annotated)
- Committer:
- GordonSin
- Date:
- Fri May 31 04:09:54 2013 +0000
- Revision:
- 0:0ed2a7c7190c
31/5/2013;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GordonSin | 0:0ed2a7c7190c | 1 | /* Copyright (c) 2012 cstyles, MIT License |
GordonSin | 0:0ed2a7c7190c | 2 | * |
GordonSin | 0:0ed2a7c7190c | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
GordonSin | 0:0ed2a7c7190c | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
GordonSin | 0:0ed2a7c7190c | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
GordonSin | 0:0ed2a7c7190c | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
GordonSin | 0:0ed2a7c7190c | 7 | * furnished to do so, subject to the following conditions: |
GordonSin | 0:0ed2a7c7190c | 8 | * |
GordonSin | 0:0ed2a7c7190c | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
GordonSin | 0:0ed2a7c7190c | 10 | * substantial portions of the Software. |
GordonSin | 0:0ed2a7c7190c | 11 | * |
GordonSin | 0:0ed2a7c7190c | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
GordonSin | 0:0ed2a7c7190c | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
GordonSin | 0:0ed2a7c7190c | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
GordonSin | 0:0ed2a7c7190c | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
GordonSin | 0:0ed2a7c7190c | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
GordonSin | 0:0ed2a7c7190c | 17 | */ |
GordonSin | 0:0ed2a7c7190c | 18 | |
GordonSin | 0:0ed2a7c7190c | 19 | #ifndef LM75B_H |
GordonSin | 0:0ed2a7c7190c | 20 | #define LM75B_H |
GordonSin | 0:0ed2a7c7190c | 21 | |
GordonSin | 0:0ed2a7c7190c | 22 | #include "mbed.h" |
GordonSin | 0:0ed2a7c7190c | 23 | |
GordonSin | 0:0ed2a7c7190c | 24 | // LM75B IIC address |
GordonSin | 0:0ed2a7c7190c | 25 | #define LM75B_ADDR 0x90 |
GordonSin | 0:0ed2a7c7190c | 26 | |
GordonSin | 0:0ed2a7c7190c | 27 | // LM75B registers |
GordonSin | 0:0ed2a7c7190c | 28 | #define LM75B_Conf 0x01 |
GordonSin | 0:0ed2a7c7190c | 29 | #define LM75B_Temp 0x00 |
GordonSin | 0:0ed2a7c7190c | 30 | #define LM75B_Tos 0x03 |
GordonSin | 0:0ed2a7c7190c | 31 | #define LM75B_Thyst 0x02 |
GordonSin | 0:0ed2a7c7190c | 32 | |
GordonSin | 0:0ed2a7c7190c | 33 | //!Library for the LM75B temperature sensor. |
GordonSin | 0:0ed2a7c7190c | 34 | /*! |
GordonSin | 0:0ed2a7c7190c | 35 | The LM75B is an I2C digital temperature sensor, with a range of -55C to +125C and a 0.125C resolution. |
GordonSin | 0:0ed2a7c7190c | 36 | */ |
GordonSin | 0:0ed2a7c7190c | 37 | class LM75B |
GordonSin | 0:0ed2a7c7190c | 38 | { |
GordonSin | 0:0ed2a7c7190c | 39 | public: |
GordonSin | 0:0ed2a7c7190c | 40 | //!Creates an instance of the class. |
GordonSin | 0:0ed2a7c7190c | 41 | /*! |
GordonSin | 0:0ed2a7c7190c | 42 | Connect module at I2C address addr using I2C port pins sda and scl. |
GordonSin | 0:0ed2a7c7190c | 43 | LM75B |
GordonSin | 0:0ed2a7c7190c | 44 | */ |
GordonSin | 0:0ed2a7c7190c | 45 | LM75B(PinName sda, PinName scl); |
GordonSin | 0:0ed2a7c7190c | 46 | |
GordonSin | 0:0ed2a7c7190c | 47 | /*! |
GordonSin | 0:0ed2a7c7190c | 48 | Destroys instance. |
GordonSin | 0:0ed2a7c7190c | 49 | */ |
GordonSin | 0:0ed2a7c7190c | 50 | ~LM75B(); |
GordonSin | 0:0ed2a7c7190c | 51 | |
GordonSin | 0:0ed2a7c7190c | 52 | //!Reads the current temperature. |
GordonSin | 0:0ed2a7c7190c | 53 | /*! |
GordonSin | 0:0ed2a7c7190c | 54 | Reads the temperature register of the LM75B and converts it to a useable value. |
GordonSin | 0:0ed2a7c7190c | 55 | */ |
GordonSin | 0:0ed2a7c7190c | 56 | float read(); |
GordonSin | 0:0ed2a7c7190c | 57 | |
GordonSin | 0:0ed2a7c7190c | 58 | private: |
GordonSin | 0:0ed2a7c7190c | 59 | |
GordonSin | 0:0ed2a7c7190c | 60 | I2C i2c; |
GordonSin | 0:0ed2a7c7190c | 61 | |
GordonSin | 0:0ed2a7c7190c | 62 | }; |
GordonSin | 0:0ed2a7c7190c | 63 | |
GordonSin | 0:0ed2a7c7190c | 64 | #endif |