]>
git.gir.st - tmk_keyboard.git/blob - 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.
5 * mbed Microcontroller Library
6 * (c) Copyright 2009-2012 ARM Limited.
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:
14 * The above copyright notice and this permission notice shall be included in all copies or
15 * substantial portions of the Software.
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.
32 * #include "TSISensor.h"
35 * DigitalOut led(LED_GREEN);
39 * printf("slider percentage: %f%\r\n", tsi.readPercentage());
40 * printf("slider distance: %dmm\r\n", tsi.readDistance());
50 * Initialize the TSI Touch Sensor
55 * Read Touch Sensor percentage value
57 * @returns percentage value between [0 ... 1]
59 float readPercentage();
62 * Read Touch Sensor distance
64 * @returns distance in mm. The value is between [0 ... 40]
66 uint8_t readDistance();
69 void sliderRead(void);
70 void selfCalibration(void);