The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller

Dependencies:   BufferedArray

Dependents:   NucleoMGC3130 i2c_master

Committer:
yangcq88517
Date:
Thu Oct 08 11:14:18 2015 +0000
Revision:
2:c7d984193741
add some documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yangcq88517 2:c7d984193741 1 #include "TouchInfo.h"
yangcq88517 2:c7d984193741 2
yangcq88517 2:c7d984193741 3 void TouchInfo::set(int touchEvent, int counter)
yangcq88517 2:c7d984193741 4 {
yangcq88517 2:c7d984193741 5 value = touchEvent;
yangcq88517 2:c7d984193741 6 count = counter;
yangcq88517 2:c7d984193741 7 }
yangcq88517 2:c7d984193741 8
yangcq88517 2:c7d984193741 9 /*
yangcq88517 2:c7d984193741 10 Touch Counter: 8-bit counter; this counter determines the
yangcq88517 2:c7d984193741 11 period between the time when the hand starts moving to
yangcq88517 2:c7d984193741 12 touch until it is detected. This period is equal to [Touch
yangcq88517 2:c7d984193741 13 Counter Value] x 5 (ms). The counter starts counting when
yangcq88517 2:c7d984193741 14 the minimum approach speed required to detect a touch
yangcq88517 2:c7d984193741 15 event is exceeded, until the touch is detected. After each
yangcq88517 2:c7d984193741 16 touch detection, the counter is reset.
yangcq88517 2:c7d984193741 17 */
yangcq88517 2:c7d984193741 18 int TouchInfo::getCounter()
yangcq88517 2:c7d984193741 19 {
yangcq88517 2:c7d984193741 20 return count;
yangcq88517 2:c7d984193741 21 }
yangcq88517 2:c7d984193741 22
yangcq88517 2:c7d984193741 23 bool TouchInfo::isTouchSouthElectrode()
yangcq88517 2:c7d984193741 24 {
yangcq88517 2:c7d984193741 25 return (value & TouchSouthElectrode) == TouchSouthElectrode? true : false;
yangcq88517 2:c7d984193741 26 }
yangcq88517 2:c7d984193741 27
yangcq88517 2:c7d984193741 28 bool TouchInfo::isTouchWestElectrode()
yangcq88517 2:c7d984193741 29 {
yangcq88517 2:c7d984193741 30 return (value & TouchWestElectrode) == TouchWestElectrode? true : false;
yangcq88517 2:c7d984193741 31 }
yangcq88517 2:c7d984193741 32
yangcq88517 2:c7d984193741 33 bool TouchInfo::isTouchNorthElectrode()
yangcq88517 2:c7d984193741 34 {
yangcq88517 2:c7d984193741 35 return (value & TouchNorthElectrode) == TouchNorthElectrode? true : false;
yangcq88517 2:c7d984193741 36 }
yangcq88517 2:c7d984193741 37
yangcq88517 2:c7d984193741 38 bool TouchInfo::isTouchEastElectrode()
yangcq88517 2:c7d984193741 39 {
yangcq88517 2:c7d984193741 40 return (value & TouchEastElectrode) == TouchEastElectrode? true : false;
yangcq88517 2:c7d984193741 41 }
yangcq88517 2:c7d984193741 42
yangcq88517 2:c7d984193741 43 bool TouchInfo::isTouchCenterElectrode()
yangcq88517 2:c7d984193741 44 {
yangcq88517 2:c7d984193741 45 return (value & TouchCenterElectrode) == TouchCenterElectrode? true : false;
yangcq88517 2:c7d984193741 46 }
yangcq88517 2:c7d984193741 47
yangcq88517 2:c7d984193741 48 bool TouchInfo::isTapSouthElectrode()
yangcq88517 2:c7d984193741 49 {
yangcq88517 2:c7d984193741 50 return (value & TapSouthElectrode) == TapSouthElectrode? true : false;
yangcq88517 2:c7d984193741 51 }
yangcq88517 2:c7d984193741 52
yangcq88517 2:c7d984193741 53 bool TouchInfo::isTapWestElectrode()
yangcq88517 2:c7d984193741 54 {
yangcq88517 2:c7d984193741 55 return (value & TapWestElectrode) == TapWestElectrode? true : false;
yangcq88517 2:c7d984193741 56 }
yangcq88517 2:c7d984193741 57
yangcq88517 2:c7d984193741 58 bool TouchInfo::isTapNorthElectrode()
yangcq88517 2:c7d984193741 59 {
yangcq88517 2:c7d984193741 60 return (value & TapNorthElectrode) == TapNorthElectrode? true : false;
yangcq88517 2:c7d984193741 61 }
yangcq88517 2:c7d984193741 62
yangcq88517 2:c7d984193741 63 bool TouchInfo::isTapEastElectrode()
yangcq88517 2:c7d984193741 64 {
yangcq88517 2:c7d984193741 65 return (value & TapEastElectrode) == TapEastElectrode? true : false;
yangcq88517 2:c7d984193741 66 }
yangcq88517 2:c7d984193741 67
yangcq88517 2:c7d984193741 68 bool TouchInfo::isTapCenterElectrode()
yangcq88517 2:c7d984193741 69 {
yangcq88517 2:c7d984193741 70 return (value & TapCenterElectrode) == TapCenterElectrode? true : false;
yangcq88517 2:c7d984193741 71 }
yangcq88517 2:c7d984193741 72
yangcq88517 2:c7d984193741 73 bool TouchInfo::isDoubleTapSouthElectrode()
yangcq88517 2:c7d984193741 74 {
yangcq88517 2:c7d984193741 75 return (value & DoubleTapSouthElectrode) == DoubleTapSouthElectrode? true : false;
yangcq88517 2:c7d984193741 76 }
yangcq88517 2:c7d984193741 77
yangcq88517 2:c7d984193741 78 bool TouchInfo::isDoubleTapWestElectrode()
yangcq88517 2:c7d984193741 79 {
yangcq88517 2:c7d984193741 80 return (value & DoubleTapWestElectrode) == DoubleTapWestElectrode? true : false;
yangcq88517 2:c7d984193741 81 }
yangcq88517 2:c7d984193741 82
yangcq88517 2:c7d984193741 83 bool TouchInfo::isDoubleTapNorthElectrode()
yangcq88517 2:c7d984193741 84 {
yangcq88517 2:c7d984193741 85 return (value & DoubleTapNorthElectrode) == DoubleTapNorthElectrode? true : false;
yangcq88517 2:c7d984193741 86 }
yangcq88517 2:c7d984193741 87
yangcq88517 2:c7d984193741 88 bool TouchInfo::isDoubleTapEastElectrode()
yangcq88517 2:c7d984193741 89 {
yangcq88517 2:c7d984193741 90 return (value & DoubleTapEastElectrode) == DoubleTapEastElectrode? true : false;
yangcq88517 2:c7d984193741 91 }
yangcq88517 2:c7d984193741 92
yangcq88517 2:c7d984193741 93 bool TouchInfo::isDoubleTapCenterElectrode()
yangcq88517 2:c7d984193741 94 {
yangcq88517 2:c7d984193741 95 return (value & DoubleTapCenterElectrode) == DoubleTapCenterElectrode? true : false;
yangcq88517 2:c7d984193741 96 }