Library for initializing, configuring, and acquiring data from the Atmel QT2100 device. The QT2100 is a capacitive touch controller with 10 configurable QTouch® channels, supporting up to seven buttons, and either one slider or one wheel.
QT2100.h@0:2d6c5d39b4de, 2015-01-13 (annotated)
- Committer:
- armed
- Date:
- Tue Jan 13 00:11:41 2015 +0000
- Revision:
- 0:2d6c5d39b4de
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
armed | 0:2d6c5d39b4de | 1 | |
armed | 0:2d6c5d39b4de | 2 | /* |
armed | 0:2d6c5d39b4de | 3 | Copyright (c) 2015 John Magyar |
armed | 0:2d6c5d39b4de | 4 | |
armed | 0:2d6c5d39b4de | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
armed | 0:2d6c5d39b4de | 6 | of this software and associated documentation files (the "Software"), to deal |
armed | 0:2d6c5d39b4de | 7 | in the Software without restriction, including without limitation the rights |
armed | 0:2d6c5d39b4de | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
armed | 0:2d6c5d39b4de | 9 | copies of the Software, and to permit persons to whom the Software is |
armed | 0:2d6c5d39b4de | 10 | furnished to do so, subject to the following conditions: |
armed | 0:2d6c5d39b4de | 11 | |
armed | 0:2d6c5d39b4de | 12 | The above copyright notice and this permission notice shall be included in |
armed | 0:2d6c5d39b4de | 13 | all copies or substantial portions of the Software. |
armed | 0:2d6c5d39b4de | 14 | |
armed | 0:2d6c5d39b4de | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
armed | 0:2d6c5d39b4de | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
armed | 0:2d6c5d39b4de | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
armed | 0:2d6c5d39b4de | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
armed | 0:2d6c5d39b4de | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
armed | 0:2d6c5d39b4de | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
armed | 0:2d6c5d39b4de | 21 | THE SOFTWARE. |
armed | 0:2d6c5d39b4de | 22 | */ |
armed | 0:2d6c5d39b4de | 23 | |
armed | 0:2d6c5d39b4de | 24 | #ifndef QT2100_H |
armed | 0:2d6c5d39b4de | 25 | #define QT2100_H |
armed | 0:2d6c5d39b4de | 26 | |
armed | 0:2d6c5d39b4de | 27 | #include "mbed.h" |
armed | 0:2d6c5d39b4de | 28 | |
armed | 0:2d6c5d39b4de | 29 | /* |
armed | 0:2d6c5d39b4de | 30 | |
armed | 0:2d6c5d39b4de | 31 | Header file for the Atmel QT2100 Capacative Touch sensor device Mbed library. |
armed | 0:2d6c5d39b4de | 32 | |
armed | 0:2d6c5d39b4de | 33 | The QT2100 is a capacitive touch controller device with 10 configurable QTouch channels, |
armed | 0:2d6c5d39b4de | 34 | supporting up to seven touch buttons, and either a single slider (or wheel). |
armed | 0:2d6c5d39b4de | 35 | |
armed | 0:2d6c5d39b4de | 36 | Datasheet: http://www.atmel.com/images/at42qt2100_e_level0%2013ww04.pdf |
armed | 0:2d6c5d39b4de | 37 | |
armed | 0:2d6c5d39b4de | 38 | */ |
armed | 0:2d6c5d39b4de | 39 | |
armed | 0:2d6c5d39b4de | 40 | class QT2100 |
armed | 0:2d6c5d39b4de | 41 | { |
armed | 0:2d6c5d39b4de | 42 | public: |
armed | 0:2d6c5d39b4de | 43 | QT2100(PinName mosi, |
armed | 0:2d6c5d39b4de | 44 | PinName miso, |
armed | 0:2d6c5d39b4de | 45 | PinName sck, |
armed | 0:2d6c5d39b4de | 46 | PinName cs, |
armed | 0:2d6c5d39b4de | 47 | PinName tx, |
armed | 0:2d6c5d39b4de | 48 | PinName rx); |
armed | 0:2d6c5d39b4de | 49 | ~QT2100(); |
armed | 0:2d6c5d39b4de | 50 | |
armed | 0:2d6c5d39b4de | 51 | public: |
armed | 0:2d6c5d39b4de | 52 | void init(); |
armed | 0:2d6c5d39b4de | 53 | void terminalDisplay(); |
armed | 0:2d6c5d39b4de | 54 | void xfer3bytes(int byte0, int byte1, int byte2); |
armed | 0:2d6c5d39b4de | 55 | void verifyChannels(); |
armed | 0:2d6c5d39b4de | 56 | void devId(); |
armed | 0:2d6c5d39b4de | 57 | int8_t keys(); |
armed | 0:2d6c5d39b4de | 58 | int8_t slider(); |
armed | 0:2d6c5d39b4de | 59 | int8_t wheel(); |
armed | 0:2d6c5d39b4de | 60 | |
armed | 0:2d6c5d39b4de | 61 | private: |
armed | 0:2d6c5d39b4de | 62 | SPI _spi; |
armed | 0:2d6c5d39b4de | 63 | DigitalOut _cs; |
armed | 0:2d6c5d39b4de | 64 | Serial _pc; |
armed | 0:2d6c5d39b4de | 65 | }; |
armed | 0:2d6c5d39b4de | 66 | |
armed | 0:2d6c5d39b4de | 67 | #endif // QT2100_H |