31 #if defined(SWIGJAVASCRIPT) 32 #if NODE_MODULE_VERSION >= 0x000D 110 Gpio(
int pin,
bool owner =
true,
bool raw =
false)
118 if (m_gpio == NULL) {
119 throw std::invalid_argument(
"Invalid GPIO pin specified");
135 if (m_gpio == NULL) {
136 throw std::invalid_argument(
"Invalid GPIO context");
158 #if defined(SWIGPYTHON) 164 #elif defined(SWIGJAVASCRIPT) 166 v8isr(uv_work_t* req,
int status)
168 #if NODE_MODULE_VERSION >= 0x000D 169 v8::HandleScope scope(v8::Isolate::GetCurrent());
173 v8::Local<v8::Value> argv[] = { SWIGV8_INTEGER_NEW(-1) };
174 #if NODE_MODULE_VERSION >= 0x000D 175 v8::Local<v8::Function> f = v8::Local<v8::Function>::New(v8::Isolate::GetCurrent(), This->m_v8isr);
176 f->Call(SWIGV8_CURRENT_CONTEXT()->Global(), argc, argv);
178 This->m_v8isr->Call(SWIGV8_CURRENT_CONTEXT()->Global(), argc, argv);
192 uv_work_t* req =
new uv_work_t;
194 uv_queue_work(uv_default_loop(), req, nop, v8isr);
200 #if NODE_MODULE_VERSION >= 0x000D 201 m_v8isr.Reset(v8::Isolate::GetCurrent(), func);
203 m_v8isr = v8::Persistent<v8::Function>::New(func);
207 #elif defined(SWIGJAVA) || defined(JAVACALLBACK) 209 isr(
Edge mode, jobject runnable)
224 isr(
Edge mode,
void (*fptr)(
void*),
void* args)
238 #if defined(SWIGJAVASCRIPT) 239 #if NODE_MODULE_VERSION >= 0x000D 282 throw std::runtime_error(
"Failed to read direction");
361 #if defined(SWIGJAVASCRIPT) 362 v8::Persistent<v8::Function> m_v8isr;
int read()
Definition: gpio.hpp:293
Result
Definition: types.hpp:204
mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner)
API to General Purpose IO.
Definition: gpio.hpp:95
Result write(int value)
Definition: gpio.hpp:304
mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t edge, void(*fptr)(void *), void *args)
unsigned int mraa_boolean_t
Definition: common.h:78
Gpio(int pin, bool owner=true, bool raw=false)
Definition: gpio.hpp:110
mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev)
InputMode
Definition: gpio.hpp:75
mraa_result_t mraa_gpio_input_mode(mraa_gpio_context dev, mraa_gpio_input_mode_t mode)
Result isr(Edge mode, void(*fptr)(void *), void *args)
Definition: gpio.hpp:224
mraa_result_t mraa_gpio_close(mraa_gpio_context dev)
~Gpio()
Definition: gpio.hpp:143
OutputMode
Definition: gpio.hpp:83
mraa_result_t mraa_gpio_dir(mraa_gpio_context dev, mraa_gpio_dir_t dir)
Dir
Definition: gpio.hpp:55
mraa_gpio_dir_t
Definition: gpio.h:73
mraa_gpio_mode_t
Definition: gpio.h:60
Edge
Definition: gpio.hpp:65
mraa_result_t mraa_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode)
int mraa_gpio_get_pin(mraa_gpio_context dev)
mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode)
Result edge(Edge mode)
Definition: gpio.hpp:154
mraa_gpio_edge_t
Definition: gpio.h:83
mraa_gpio_context mraa_gpio_init_raw(int gpiopin)
Result isrExit()
Definition: gpio.hpp:236
struct _gpio * mraa_gpio_context
Definition: gpio.h:55
mraa_gpio_context mraa_gpio_init(int pin)
Result dir(Dir dir)
Definition: gpio.hpp:266
int mraa_gpio_get_pin_raw(mraa_gpio_context dev)
Result outputMode(OutputMode mode)
Definition: gpio.hpp:354
int getPin(bool raw=false)
Definition: gpio.hpp:327
mraa_result_t mraa_gpio_read_dir(mraa_gpio_context dev, mraa_gpio_dir_t *dir)
Gpio(void *gpio_context)
Definition: gpio.hpp:132
Result useMmap(bool enable)
Definition: gpio.hpp:315
mraa_gpio_input_mode_t
Definition: gpio.h:93
mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value)
Dir readDir()
Definition: gpio.hpp:278
Result mode(Mode mode)
Definition: gpio.hpp:255
DEPRECATED mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap)
mraa_gpio_out_driver_mode_t
Definition: gpio.h:102
Result inputMode(InputMode mode)
Definition: gpio.hpp:342
int mraa_gpio_read(mraa_gpio_context dev)
Mode
Definition: gpio.hpp:45
mraa_result_t mraa_gpio_out_driver_mode(mraa_gpio_context dev, mraa_gpio_out_driver_mode_t mode)