MityDSP Documentation Index

tcDspTouchScreen

Introduction

The tcDspTouchScreen class is used to provide access to a touch screen overlay device. It is usually used in concert with the tcDspDisplay class (although this is not a requirement). Routines are provided to determine whether or not the screen is being touched, what position is the last touch (in pixels or raw ADC counts), and set/get calibration parameters.

Convenience routines are also provided to assist with calibrating the touch screen device.

See also:
MityDSP::tcDspTouchScreen Class Reference
MityDSP::tcDspDisplay Class Reference

Example

This is a simple example of tcDspTouchScreen creation and usage:

 {
     bool touched;
     tcDspTouchScreen *myTouchScreen;
     SEM_Handle myTouchSem = SEM_create(0, NULL);
     tcDspDisplay::tsScreenCoords myPos;

     // create tcDspTouchScreen instance
     myTouchScreen = new tcDspTouchScreen((void *)0xB0000280, 320, 240,
                                          myTouchSem);

     // perform calibration
     printf("Touch screen upper left...\n");
     myTouchScreen->CalUpperLeft(SYS_FOREVER);
     printf("Touch screen lower right...\n");
     myTouchScreen->CalLowerRight(SYS_FOREVER);

     // enable notification of screen "touch" events
     myTouchScreen->EventEnable(tcDspTouchScreen::eePenDown);

     // do something
     while (true)
     {
         // get positions while screen is being touched
         do
         {
             touched = myTouchScreen->GetPosition(myPos);

             // application-specific actions
             ...
         } while (touched);

         // wait for screen to be touched again
         SEM_pend(myTouchSem, SYS_FOREVER);
     }
 } 

  
Generated on Fri Sep 23 16:33:45 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.