TTP229 16key touch keypad

Dependents:   TTP229_sample

TTP229 16key touch keypad.
/media/uploads/jk1lot/ttp229_MMK5gIi.jpg

This library support only 16key mode and active low mode
jamper set TP1=1(default) and TP2=0(jamper close).

pin connection

mbed                              TTP229
GPIO(InterruptIn) --------------- SDO
GPIO(DigitalOut)  --------------- SCL
             3.3V --------------- VCC
              GND --------------- GND

sample program is here.

アマゾンで購入したTTP229 を使った16キーのタッチキーパッドを使うためのライブラリです。
このボードは8keyモードにも設定できますが、このライブラリは16キーモード専用です
16キーモードに設定するには TP2を高抵抗でGNDに繋ぎます。私が入手したボードではジャンパ設定の3番をクローズにすればこの状態になります。
TP1で active low と active highの切替が出来ますが、このライブラリは active lowを想定していますので、TP1はデフォルトのまま(GNDには繋がない)にしてください。その他のジャンパは使用目的に応じて自由に設定して構いません。

詳しくはこちらをご覧ください。

Revision:
1:c20148b5c68e
Parent:
0:50226acdb872
Child:
2:550c26cd6734
--- a/TTP229.h	Sat Jul 16 11:19:03 2016 +0000
+++ b/TTP229.h	Sat Jul 16 15:29:00 2016 +0000
@@ -12,7 +12,21 @@
     ///@param sdopin PinName that support DigitalIn and InterruptIn, connected to TTP229 SDO.
     ///@param sclpin PinName that support DigitalOut, connected to TTP229 SCL.
     TTP229(PinName sdopin, PinName sclpin);
-    ///set function that is called at change state of keypad
+    /// set function that is called at change state of keypad\n
+    /// FunctionPointer is a pointer to function(no param and void return)
+    /// @code
+    /// void func();
+    /// ttp229.attach(&func);
+    /// @endcode
+    /// or to menber function(no param and void return)
+    /// @code
+    /// class Foo {
+    /// public:
+    ///     void func();
+    /// };
+    /// Foo foo;   
+    /// ttp229.attach(FunctionPointer(foo, &Foo::func));
+    /// @endcode
     void attach(const FunctionPointer& fp) {callback=fp;}
     ///get keypad status
     bitset<16> getkeys() {return sw;}