isr.js: add node.js isr example
authorBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 18 Feb 2015 14:30:22 +0000 (14:30 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 18 Feb 2015 16:41:31 +0000 (16:41 +0000)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
api/mraa/gpio.hpp
examples/javascript/isr.js [new file with mode: 0644]

index 93044d3..3709620 100644 (file)
@@ -140,8 +140,7 @@ class Gpio {
 
         mraa_result_t isr(Edge mode, v8::Handle<v8::Function> func) {
             m_v8isr = v8::Persistent<v8::Function>::New(func);
-            mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, &uvwork, this);
-            return MRAA_SUCCESS;
+            return mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, &uvwork, this);
         }
 #else
         /**
diff --git a/examples/javascript/isr.js b/examples/javascript/isr.js
new file mode 100644 (file)
index 0000000..d400c0d
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env node
+
+var m = require('mraa')
+
+function h() {
+  console.log("HELLO!!!!")
+}
+
+x = new m.Gpio(14)
+x.isr(m.EDGE_BOTH, h)