blablabla

Dependencies:   MAG3110 MMA8451Q SLCD- TSI USBDevice mbed

Committer:
Osator
Date:
Wed Apr 16 12:20:00 2014 +0000
Revision:
0:339b7abfa147
blablabla

Who changed what in which revision?

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