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