]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/peripherals/TSI/TSISensor.h
remove experimental return, cleanup slash_question key
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / tests / peripherals / TSI / TSISensor.h
1 /* Freescale Semiconductor Inc.
2 * (c) Copyright 2004-2005 Freescale Semiconductor, Inc.
3 * (c) Copyright 2001-2004 Motorola, Inc.
4 *
5 * mbed Microcontroller Library
6 * (c) Copyright 2009-2012 ARM Limited.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9 * and associated documentation files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all copies or
15 * substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef TSISENSOR_H
25 #define TSISENSOR_H
26
27 /**
28 * TSISensor example
29 *
30 * @code
31 * #include "mbed.h"
32 * #include "TSISensor.h"
33 *
34 * int main(void) {
35 * DigitalOut led(LED_GREEN);
36 * TSISensor tsi;
37 *
38 * while (true) {
39 * printf("slider percentage: %f%\r\n", tsi.readPercentage());
40 * printf("slider distance: %dmm\r\n", tsi.readDistance());
41 * wait(1);
42 * led = !led;
43 * }
44 * }
45 * @endcode
46 */
47 class TSISensor {
48 public:
49 /**
50 * Initialize the TSI Touch Sensor
51 */
52 TSISensor();
53
54 /**
55 * Read Touch Sensor percentage value
56 *
57 * @returns percentage value between [0 ... 1]
58 */
59 float readPercentage();
60
61 /**
62 * Read Touch Sensor distance
63 *
64 * @returns distance in mm. The value is between [0 ... 40]
65 */
66 uint8_t readDistance();
67
68 private:
69 void sliderRead(void);
70 void selfCalibration(void);
71 };
72
73 #endif
Imprint / Impressum