ESC Brazil 2012 Demo
Dependencies: mbed ID12RFID NokiaLCD
SRF08.h@0:4fe41724cceb, 2012-06-20 (annotated)
- Committer:
- anaran
- Date:
- Wed Jun 20 15:35:12 2012 +0000
- Revision:
- 0:4fe41724cceb
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
anaran | 0:4fe41724cceb | 1 | |
anaran | 0:4fe41724cceb | 2 | /* |
anaran | 0:4fe41724cceb | 3 | Copyright (c) 2010 Chris Styles (chris dot styles at mbed dot org) |
anaran | 0:4fe41724cceb | 4 | |
anaran | 0:4fe41724cceb | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
anaran | 0:4fe41724cceb | 6 | of this software and associated documentation files (the "Software"), to deal |
anaran | 0:4fe41724cceb | 7 | in the Software without restriction, including without limitation the rights |
anaran | 0:4fe41724cceb | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
anaran | 0:4fe41724cceb | 9 | copies of the Software, and to permit persons to whom the Software is |
anaran | 0:4fe41724cceb | 10 | furnished to do so, subject to the following conditions: |
anaran | 0:4fe41724cceb | 11 | |
anaran | 0:4fe41724cceb | 12 | The above copyright notice and this permission notice shall be included in |
anaran | 0:4fe41724cceb | 13 | all copies or substantial portions of the Software. |
anaran | 0:4fe41724cceb | 14 | |
anaran | 0:4fe41724cceb | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
anaran | 0:4fe41724cceb | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
anaran | 0:4fe41724cceb | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
anaran | 0:4fe41724cceb | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
anaran | 0:4fe41724cceb | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
anaran | 0:4fe41724cceb | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
anaran | 0:4fe41724cceb | 21 | THE SOFTWARE. |
anaran | 0:4fe41724cceb | 22 | */ |
anaran | 0:4fe41724cceb | 23 | |
anaran | 0:4fe41724cceb | 24 | #ifndef SRF08_H |
anaran | 0:4fe41724cceb | 25 | #define SRF08_H |
anaran | 0:4fe41724cceb | 26 | |
anaran | 0:4fe41724cceb | 27 | #include "mbed.h" |
anaran | 0:4fe41724cceb | 28 | |
anaran | 0:4fe41724cceb | 29 | //!Library for the SRF08 Ultrasonic Ranger |
anaran | 0:4fe41724cceb | 30 | /*! |
anaran | 0:4fe41724cceb | 31 | The SRF08 is an Ultrasonic range finder, with an I2C interface that allows the measurement to be read directly in centimetres |
anaran | 0:4fe41724cceb | 32 | */ |
anaran | 0:4fe41724cceb | 33 | class SRF08 |
anaran | 0:4fe41724cceb | 34 | { |
anaran | 0:4fe41724cceb | 35 | public: |
anaran | 0:4fe41724cceb | 36 | //!Creates an instance of the class. |
anaran | 0:4fe41724cceb | 37 | /*! |
anaran | 0:4fe41724cceb | 38 | Connect module at I2C address addr using I2C port pins sda and scl. |
anaran | 0:4fe41724cceb | 39 | SRF08 |
anaran | 0:4fe41724cceb | 40 | */ |
anaran | 0:4fe41724cceb | 41 | SRF08(PinName sda, PinName scl, int addr); |
anaran | 0:4fe41724cceb | 42 | |
anaran | 0:4fe41724cceb | 43 | /*! |
anaran | 0:4fe41724cceb | 44 | Destroys instance. |
anaran | 0:4fe41724cceb | 45 | */ |
anaran | 0:4fe41724cceb | 46 | ~SRF08(); |
anaran | 0:4fe41724cceb | 47 | |
anaran | 0:4fe41724cceb | 48 | //!Reads the current temperature. |
anaran | 0:4fe41724cceb | 49 | /*! |
anaran | 0:4fe41724cceb | 50 | Reads the temperature register of the TMP102 and converts it to a useable value. |
anaran | 0:4fe41724cceb | 51 | */ |
anaran | 0:4fe41724cceb | 52 | float read(); |
anaran | 0:4fe41724cceb | 53 | |
anaran | 0:4fe41724cceb | 54 | private: |
anaran | 0:4fe41724cceb | 55 | I2C m_i2c; |
anaran | 0:4fe41724cceb | 56 | int m_addr; |
anaran | 0:4fe41724cceb | 57 | |
anaran | 0:4fe41724cceb | 58 | }; |
anaran | 0:4fe41724cceb | 59 | |
anaran | 0:4fe41724cceb | 60 | #endif |