isr.js: add node.js isr example
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -140,8 +140,7 @@ class Gpio {
|
|||||||
|
|
||||||
mraa_result_t isr(Edge mode, v8::Handle<v8::Function> func) {
|
mraa_result_t isr(Edge mode, v8::Handle<v8::Function> func) {
|
||||||
m_v8isr = v8::Persistent<v8::Function>::New(func);
|
m_v8isr = v8::Persistent<v8::Function>::New(func);
|
||||||
mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, &uvwork, this);
|
return mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, &uvwork, this);
|
||||||
return MRAA_SUCCESS;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/**
|
/**
|
||||||
|
|||||||
10
examples/javascript/isr.js
Normal file
10
examples/javascript/isr.js
Normal file
@@ -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)
|
||||||
Reference in New Issue
Block a user