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