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