Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NucleoMGC3130 i2c_master
TouchInfo.h
00001 #ifndef UK_AC_HERTS_SMARTLAB_MGC3130_TouchInfo 00002 #define UK_AC_HERTS_SMARTLAB_MGC3130_TouchInfo 00003 00004 /// Contains touch information 00005 class TouchInfo 00006 { 00007 private: 00008 /** 2 bytes bit mask 00009 *Bit 0: Touch South electrode 00010 *Bit 1: Touch West electrode 00011 *Bit 2: Touch North electrode 00012 *Bit 3: Touch East electrode 00013 *Bit 4: Touch Center electrode 00014 *Bit 5: Tap South electrode 00015 *Bit 6: Tap West electrode 00016 *Bit 7: Tap North electrode 00017 *Bit 8: Tap East electrode 00018 *Bit 9: Tap Center electrode 00019 *Bit 10: Double Tap South electrode 00020 *Bit 11: Double Tap West electrode 00021 *Bit 12: Double Tap North electrode 00022 *Bit 13: Double Tap East electrode 00023 *Bit 14: Double Tap Center electrode 00024 *Bit 15: This bit is reserved. 00025 */ 00026 int value; 00027 00028 /** Bits 16...23:Touch Counter: 8-bit counter; this counter determines the 00029 *period between the time when the hand starts moving to 00030 *touch until it is detected. This period is equal to [Touch 00031 *Counter Value] x 5 (ms). The counter starts counting when 00032 *the minimum approach speed required to detect a touch 00033 *event is exceeded, until the touch is detected. After each 00034 *touch detection, the counter is reset. 00035 *Bits 24...31:These bits are reserved. 00036 */ 00037 int count; 00038 00039 static const int TouchSouthElectrode = 0x0100; 00040 static const int TouchWestElectrode = 0x0200; 00041 static const int TouchNorthElectrode = 0x0400; 00042 static const int TouchEastElectrode = 0x0800; 00043 static const int TouchCenterElectrode = 0x1000; 00044 static const int TapSouthElectrode = 0x2000; 00045 static const int TapWestElectrode = 0x4000; 00046 static const int TapNorthElectrode = 0x8000; 00047 static const int TapEastElectrode = 0x0001; 00048 static const int TapCenterElectrode = 0x0002; 00049 static const int DoubleTapSouthElectrode = 0x0004; 00050 static const int DoubleTapWestElectrode = 0x0008; 00051 static const int DoubleTapNorthElectrode = 0x0010; 00052 static const int DoubleTapEastElectrode = 0x0020; 00053 static const int DoubleTapCenterElectrode = 0x0040; 00054 00055 public: 00056 /** Set the internal memory, used by API itself. 00057 * 00058 * @param touchEvent 2 bytes bit mask 00059 * @param counter 1 byte 00060 */ 00061 void set(int touchEvent, int counter); 00062 00063 /** 00064 *Touch Counter: this counter determines the 00065 *period between the time when the hand starts moving to 00066 *touch until it is detected. This period is equal to [Touch 00067 *Counter Value] x 5 (ms). The counter starts counting when 00068 *the minimum approach speed required to detect a touch 00069 *event is exceeded, until the touch is detected. After each 00070 *touch detection, the counter is reset. 00071 * 00072 * @returns 8-bit counter 00073 */ 00074 int getCounter(); 00075 00076 /** Check if touch south electrode is detected. 00077 * 00078 * @returns 00079 * true qualified 00080 * false not qualified 00081 */ 00082 bool isTouchSouthElectrode(); 00083 00084 /** Check if touch west electrode is detected. 00085 * 00086 * @returns 00087 * true qualified 00088 * false not qualified 00089 */ 00090 bool isTouchWestElectrode(); 00091 00092 /** Check if touch north electrode is detected. 00093 * 00094 * @returns 00095 * true qualified 00096 * false not qualified 00097 */ 00098 bool isTouchNorthElectrode(); 00099 00100 /** Check if touch east electrode is detected. 00101 * 00102 * @returns 00103 * true qualified 00104 * false not qualified 00105 */ 00106 bool isTouchEastElectrode(); 00107 00108 /** Check if touch center electrode is detected. 00109 * 00110 * @returns 00111 * true qualified 00112 * false not qualified 00113 */ 00114 bool isTouchCenterElectrode(); 00115 00116 /** Check if tap south electrode is detected. 00117 * 00118 * @returns 00119 * true qualified 00120 * false not qualified 00121 */ 00122 bool isTapSouthElectrode(); 00123 00124 /** Check if tap west electrode is detected. 00125 * 00126 * @returns 00127 * true qualified 00128 * false not qualified 00129 */ 00130 bool isTapWestElectrode(); 00131 00132 /** Check if tap north electrode is detected. 00133 * 00134 * @returns 00135 * true qualified 00136 * false not qualified 00137 */ 00138 bool isTapNorthElectrode(); 00139 00140 /** Check if tap east electrode is detected. 00141 * 00142 * @returns 00143 * true qualified 00144 * false not qualified 00145 */ 00146 bool isTapEastElectrode(); 00147 00148 /** Check if tap center electrode is detected. 00149 * 00150 * @returns 00151 * true qualified 00152 * false not qualified 00153 */ 00154 bool isTapCenterElectrode(); 00155 00156 /** Check if double tap south electrode is detected. 00157 * 00158 * @returns 00159 * true qualified 00160 * false not qualified 00161 */ 00162 bool isDoubleTapSouthElectrode(); 00163 00164 /** Check if double tap west electrode is detected. 00165 * 00166 * @returns 00167 * true qualified 00168 * false not qualified 00169 */ 00170 bool isDoubleTapWestElectrode(); 00171 00172 /** Check if double tap north electrode is detected. 00173 * 00174 * @returns 00175 * true qualified 00176 * false not qualified 00177 */ 00178 bool isDoubleTapNorthElectrode(); 00179 00180 /** Check if double tap east electrode is detected. 00181 * 00182 * @returns 00183 * true qualified 00184 * false not qualified 00185 */ 00186 bool isDoubleTapEastElectrode(); 00187 00188 /** Check if double tap center electrode is detected. 00189 * 00190 * @returns 00191 * true qualified 00192 * false not qualified 00193 */ 00194 bool isDoubleTapCenterElectrode(); 00195 }; 00196 00197 #endif
Generated on Fri Jul 15 2022 02:54:57 by
