IOIO board on Android: Working with external interrupts and change notifications

146 Views Asked by At

I am developing an Android application which controls some relays based on some sensors input. I have everything set up and code works just fine, except I don't like the fact that I have to poll for state changes in my activity.

My code is based on this example: https://github.com/ytai/ioio/blob/master/applications/HelloIOIO/src/main/java/ioio/examples/hello/MainActivity.java

For instance:

fun looper() {
    // ... 

    DigitalInput in = ioio.openDigitalInput(exti1Pin, DigitalInput.Spec.Mode.PULL_DOWN);
    boolean value = in.read();
    // do something if true

    // ...

} // looper

The PIC24 on the IOIO board comes with 5 external interrupts as well as change notifications on most pins. However I can't seem to find any way to set up interrupt handlers or change notifications.

Would appreciate any pointers/ideas/suggestions

0

There are 0 best solutions below