Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
TSISensor.h
00001 /* Freescale Semiconductor Inc. 00002 * (c) Copyright 2004-2005 Freescale Semiconductor, Inc. 00003 * (c) Copyright 2001-2004 Motorola, Inc. 00004 * 00005 * mbed Microcontroller Library 00006 * (c) Copyright 2009-2012 ARM Limited. 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00009 * and associated documentation files (the "Software"), to deal in the Software without 00010 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00011 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included in all copies or 00015 * substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00018 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00019 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00020 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 */ 00023 00024 #ifndef TSISENSOR_H 00025 #define TSISENSOR_H 00026 00027 /** 00028 * TSISensor example 00029 * 00030 * @code 00031 * #include "mbed.h" 00032 * #include "TSISensor.h" 00033 * 00034 * int main(void) { 00035 * DigitalOut led(LED_GREEN); 00036 * TSISensor tsi; 00037 * 00038 * while (true) { 00039 * printf("slider percentage: %f%\r\n", tsi.readPercentage()); 00040 * printf("slider distance: %dmm\r\n", tsi.readDistance()); 00041 * wait(1); 00042 * led = !led; 00043 * } 00044 * } 00045 * @endcode 00046 */ 00047 class TSISensor { 00048 public: 00049 /** 00050 * Initialize the TSI Touch Sensor 00051 */ 00052 TSISensor(); 00053 00054 /** 00055 * Read Touch Sensor percentage value 00056 * 00057 * @returns percentage value between [0 ... 1] 00058 */ 00059 float readPercentage(); 00060 00061 /** 00062 * Read Touch Sensor distance 00063 * 00064 * @returns distance in mm. The value is between [0 ... 40] 00065 */ 00066 uint8_t readDistance(); 00067 00068 private: 00069 void sliderRead(void); 00070 void selfCalibration(void); 00071 }; 00072 00073 #endif
Generated on Sun Jul 17 2022 08:25:32 by 1.7.2