GPIO PinStatusListener [message #1843351] |
Sat, 24 July 2021 09:59  |
Eclipse User |
|
|
|
I got the instance of pin by
KuraGPIOPin pin = gpioService.getPinByTerminal(address, direction, mode, trigger);
followed by the pin.open();
and here are the direction, mode and trigger options used -
KuraGPIODirection.INPUT, KuraGPIOMode.INPUT_PULL_UP, KuraGPIOTrigger.NONE
when I added PinStatusListener to this instance I get UnSupportedOperationException.
java.lang.UnsupportedOperationException: Cannot start notification
at com.oracle.dio.gpio.impl.GPIOPinImpl.setInputListener(GPIOPinImpl.java:186)
at org.eclipse.kura.linux.gpio.JdkDioPin.addPinStatusListener(JdkDioPin.java:127)
The documentation says that it is allowed for GPIO type input. I am able to read the value of the pin, so the pin instance is working fine. Did it work for anyone?
|
|
|
Re: GPIO PinStatusListener [message #1843418 is a reply to message #1843351] |
Wed, 28 July 2021 11:24  |
Eclipse User |
|
|
|
Hi,
the Kura GPIOService is based on the JdkDio library that interacts with the underlying OS. I could be possible that some GPIOs doesn't support listeners at OS level, so trying to register a listener causes an UnsupportedOperation exception.
Try to take a look at the GPIO example for further info about the code.
Moreover, I noticed that you set KuraGPIOTrigger.NONE, but in this way the listener will not be activated by an event on the pin.
|
|
|
Powered by
FUDForum. Page generated in 0.06219 seconds