eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.37k stars 614 forks source link

FTDI Interrupts do not work with Java and most likely Python #419

Closed petreeftime closed 8 years ago

petreeftime commented 8 years ago

At https://github.com/intel-iot-devkit/mraa/blob/master/src/gpio/gpio.c#L272 the FTDI GPIO interrupt handler is called, but setup for Java is called a few lines after this: https://github.com/intel-iot-devkit/mraa/blob/master/src/gpio/gpio.c#L295, additionally, Python is handling its' ISRs here: https://github.com/intel-iot-devkit/mraa/blob/master/src/gpio/gpio.c#L321, code which is again not called by the FTDI interrupt function handler.

The code should be refactored such that bindings can work with FTDI. Perhaps each language could expose a per-thread setup, isr call and teardown function if they require it.

arfoll commented 8 years ago

@whbruce this is a bit of a problem, didn't realise this didn't work from SWIG :/ How can we fix this?

whbruce commented 8 years ago

Sorry didn't test with SWIG bindings. As per @petreeftime's comments language bindings are not correctly handled and refactoring is required. I think I can fix this by making gpio interrupt adv_funcs more granular so ft4222 thread is handled the same way as gpio "poll" thread. I'll get to this right away.

alext-mkrs commented 8 years ago

Fixed with PR #420, closing.