This is the vcdMaker demo project. See http://vcdmaker.org for details. vcdMaker is supposed to help engineers to debug their applications and systems. It transforms text log files into the VCD format which can be easily displayed as a waveform.
Dependencies: mbed vcdLogger vcdSignal
TSI/TSISensor.h@0:9a59cffaafad, 2016-02-12 (annotated)
- Committer:
- ketjow
- Date:
- Fri Feb 12 21:38:04 2016 +0000
- Revision:
- 0:9a59cffaafad
vcdMaker demo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ketjow | 0:9a59cffaafad | 1 | /* Freescale Semiconductor Inc. |
ketjow | 0:9a59cffaafad | 2 | * (c) Copyright 2004-2005 Freescale Semiconductor, Inc. |
ketjow | 0:9a59cffaafad | 3 | * (c) Copyright 2001-2004 Motorola, Inc. |
ketjow | 0:9a59cffaafad | 4 | * |
ketjow | 0:9a59cffaafad | 5 | * mbed Microcontroller Library |
ketjow | 0:9a59cffaafad | 6 | * (c) Copyright 2009-2012 ARM Limited. |
ketjow | 0:9a59cffaafad | 7 | * |
ketjow | 0:9a59cffaafad | 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ketjow | 0:9a59cffaafad | 9 | * and associated documentation files (the "Software"), to deal in the Software without |
ketjow | 0:9a59cffaafad | 10 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
ketjow | 0:9a59cffaafad | 11 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
ketjow | 0:9a59cffaafad | 12 | * Software is furnished to do so, subject to the following conditions: |
ketjow | 0:9a59cffaafad | 13 | * |
ketjow | 0:9a59cffaafad | 14 | * The above copyright notice and this permission notice shall be included in all copies or |
ketjow | 0:9a59cffaafad | 15 | * substantial portions of the Software. |
ketjow | 0:9a59cffaafad | 16 | * |
ketjow | 0:9a59cffaafad | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ketjow | 0:9a59cffaafad | 18 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ketjow | 0:9a59cffaafad | 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ketjow | 0:9a59cffaafad | 20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ketjow | 0:9a59cffaafad | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ketjow | 0:9a59cffaafad | 22 | */ |
ketjow | 0:9a59cffaafad | 23 | |
ketjow | 0:9a59cffaafad | 24 | #ifndef TSISENSOR_H |
ketjow | 0:9a59cffaafad | 25 | #define TSISENSOR_H |
ketjow | 0:9a59cffaafad | 26 | |
ketjow | 0:9a59cffaafad | 27 | /** |
ketjow | 0:9a59cffaafad | 28 | * TSISensor example |
ketjow | 0:9a59cffaafad | 29 | * |
ketjow | 0:9a59cffaafad | 30 | * @code |
ketjow | 0:9a59cffaafad | 31 | * #include "mbed.h" |
ketjow | 0:9a59cffaafad | 32 | * #include "TSISensor.h" |
ketjow | 0:9a59cffaafad | 33 | * |
ketjow | 0:9a59cffaafad | 34 | * int main(void) { |
ketjow | 0:9a59cffaafad | 35 | * PwmOut led(LED_GREEN); |
ketjow | 0:9a59cffaafad | 36 | * TSISensor tsi; |
ketjow | 0:9a59cffaafad | 37 | * |
ketjow | 0:9a59cffaafad | 38 | * while (true) { |
ketjow | 0:9a59cffaafad | 39 | * led = 1.0 - tsi.readPercentage(); |
ketjow | 0:9a59cffaafad | 40 | * wait(0.1); |
ketjow | 0:9a59cffaafad | 41 | * } |
ketjow | 0:9a59cffaafad | 42 | * } |
ketjow | 0:9a59cffaafad | 43 | * @endcode |
ketjow | 0:9a59cffaafad | 44 | */ |
ketjow | 0:9a59cffaafad | 45 | class TSISensor { |
ketjow | 0:9a59cffaafad | 46 | public: |
ketjow | 0:9a59cffaafad | 47 | /** |
ketjow | 0:9a59cffaafad | 48 | * Initialize the TSI Touch Sensor |
ketjow | 0:9a59cffaafad | 49 | */ |
ketjow | 0:9a59cffaafad | 50 | TSISensor(); |
ketjow | 0:9a59cffaafad | 51 | |
ketjow | 0:9a59cffaafad | 52 | /** |
ketjow | 0:9a59cffaafad | 53 | * Read Touch Sensor percentage value |
ketjow | 0:9a59cffaafad | 54 | * |
ketjow | 0:9a59cffaafad | 55 | * @returns percentage value between [0 ... 1] |
ketjow | 0:9a59cffaafad | 56 | */ |
ketjow | 0:9a59cffaafad | 57 | float readPercentage(); |
ketjow | 0:9a59cffaafad | 58 | |
ketjow | 0:9a59cffaafad | 59 | /** |
ketjow | 0:9a59cffaafad | 60 | * Read Touch Sensor distance |
ketjow | 0:9a59cffaafad | 61 | * |
ketjow | 0:9a59cffaafad | 62 | * @returns distance in mm. The value is between [0 ... 40] |
ketjow | 0:9a59cffaafad | 63 | */ |
ketjow | 0:9a59cffaafad | 64 | uint8_t readDistance(); |
ketjow | 0:9a59cffaafad | 65 | uint16_t readValue(uint8_t); |
ketjow | 0:9a59cffaafad | 66 | void TSISensor_reset(void); |
ketjow | 0:9a59cffaafad | 67 | |
ketjow | 0:9a59cffaafad | 68 | private: |
ketjow | 0:9a59cffaafad | 69 | void sliderRead(void); |
ketjow | 0:9a59cffaafad | 70 | void selfCalibration(void); |
ketjow | 0:9a59cffaafad | 71 | }; |
ketjow | 0:9a59cffaafad | 72 | |
ketjow | 0:9a59cffaafad | 73 | #endif |