1

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

Nick M
  • 2,424
  • 5
  • 34
  • 57
  • 1
    Just by looking at the [wiki](https://github.com/ytai/ioio/wiki), my understanding is that the board simplifies hardware access to software developers. Assuming you are using the OTG board: https://github.com/ytai/ioio/wiki/Getting-To-Know-The-IOIO-OTG-Board my guess is that if you want true hardware interrupts, you'll have to change the firmware, but otherwise the library has facility for handling [motor control](https://github.com/ytai/ioio/wiki/Motor-control). On Android I believe USB and Bluetooth comms are serial (so no true interrupts, just software polling/message passing) – Morrison Chang Mar 19 '21 at 22:22
  • I am indeed using the OTG board. I've found some bits of code regarding `setChangeNotification(pin#)` which seems to leverage the MCUs CN feature (which is alright for me even if it comes with a bit of latency compared to EXTI which I can definitely implement straight into the firmware if ever needed), but can't seem to figure out how to use it exactly. I was hoping it would be smth along the lines of `setChangeNotification(pin#, Runnable{ // ... })`Still playing with it. – Nick M Mar 19 '21 at 22:27
  • 1
    Looks like this is not currently possible. See [here](https://groups.google.com/g/ioio-users/c/SMh0cA5vYOg/m/GPUXMaRXfMIJ). You may get more help from ytai on the ioio-users google group compared to here on SO. – topher217 Jun 15 '21 at 06:52

0 Answers0