.
Dependencies: SPI_TFT_ILI9341
Fork of SeeedStudioTFTv2 by
Revision 1:1745fdf054b5, committed 2011-07-14
- Comitter:
- dreschpe
- Date:
- Thu Jul 14 21:27:19 2011 +0000
- Parent:
- 0:d78b00f167cb
- Child:
- 2:ef7972c29c0e
- Commit message:
- doxygen fix
Changed in this revision
| touch_tft.cpp | Show annotated file Show diff for this revision Revisions of this file |
| touch_tft.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/touch_tft.cpp Thu Jul 14 21:02:43 2011 +0000
+++ b/touch_tft.cpp Thu Jul 14 21:27:19 2011 +0000
@@ -182,7 +182,7 @@
return (p);
}
-bool is_touched(point a){
+bool touch_tft::is_touched(point a){
if (a.x > threshold & a.y > threshold) return(true);
else return(false);
}
--- a/touch_tft.h Thu Jul 14 21:02:43 2011 +0000
+++ b/touch_tft.h Thu Jul 14 21:27:19 2011 +0000
@@ -1,3 +1,16 @@
+/* mbed library for touchscreen connected to 4 mbed pins
+ * derive from SPI_TFT lib
+ * Copyright (c) 2011 Peter Drescher - DC2PD
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
#ifndef MBED_TOUCH_H
#define MBED_TOUCH_H
@@ -9,9 +22,45 @@
unsigned short y;
};
+
+/** touchscreen control class, based on SPI_TFT
+ *
+ * Example:
+ * @code
+ *
+ * #include "mbed.h"
+ * #include "SPI_TFT.h"
+ * #include "Arial12x12.h"
+ * #include "Arial28x28.h"
+ * #include "touch_tft.h"
+ * // the TFT is connected to SPI pin 5-7
+ * // the touch is connected to 19,20,16,17
+ *
+ * touch_tft tt(p19,p20,p16,p17,p5, p6, p7, p8, p15,"TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset
+ *
+ * int main() {
+ * point p;
+ *
+ * tt.claim(stdout); // send stdout to the TFT display
+ * tt.background(Black); // set background to black
+ * tt.foreground(White); // set chars to white
+ * tt.cls(); // clear the screen
+ * tt.set_font((unsigned char*) Arial12x12); // select the font
+ * tt.set_orientation(1);
+ *
+ * tt.calibrate(); // calibrate the touch
+ * while (1) {
+ * p = tt.get_touch(); // read analog pos.
+ * if (tt.is_touched(p)) { // test if touched
+ * p = tt.to_pixel(p); // convert to pixel pos
+ * tt.fillcircle(p.x,p.y,3,Blue); // print a blue dot on the screen
+ * }
+ * }
+ * @endcode
+ */
class touch_tft : public SPI_TFT{
public:
- /** create a TFT with touch object connected to the pins
+ /** create a TFT with touch object connected to the pins:
*
* @param pin xp resistiv touch x+
* @param pin xm resistiv touch x-
@@ -26,6 +75,7 @@
/** calibrate the touch display
*
+ * User is asked to touch on two points on the screen
*/
void calibrate(void);
