Seeed I2C touch example

Dependencies:   MPR121 mbed

Fork of MPR121_HelloWorld by Sam Grove

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Fri Jul 26 21:41:55 2013 +0000
Child:
1:684222fa16bb
Commit message:
Work in progress...

Changed in this revision

LogUtil.lib Show annotated file Show diff for this revision Revisions of this file
MPR121.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LogUtil.lib	Fri Jul 26 21:41:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/sam_grove/code/LogUtil/#ef45bd2cd9bb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPR121.lib	Fri Jul 26 21:41:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/sam_grove/code/MPR121/#4c0d4b90a3ed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 26 21:41:55 2013 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "MPR121.h"
+
+// TODO: put IC in low power mode when disabled
+
+DigitalOut myled(LED1);
+DigitalOut off(LED4);
+Timer t;
+
+LogUtil logger;
+
+I2C i2c(p28, p27);
+InterruptIn irq(p26);
+MPR121 touch_pad(i2c, irq, MPR121::ADDR_VSS );
+
+int main() 
+{       
+    touch_pad.init();
+    touch_pad.enable();
+    t.start();
+    while(1)
+    {
+        if(touch_pad.isPressed())
+        {
+            uint16_t button_val = touch_pad.buttonPressed();
+            LOG("button = 0x%04x\n", button_val);
+            myled = (button_val>0) ? 1 : 0;
+        }
+//        if(t.read_ms() > 5000)
+//        {
+//            touch_pad.disable();
+//            off = 1;
+//            wait(5.0f);
+//            off = 0;
+//            touch_pad.enable();
+//            t.reset();
+//        }
+            
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jul 26 21:41:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b
\ No newline at end of file