GPIOPin.getValue() always returns false for an output pin
Peter Saitz
peter.saitz at savien.at
Wed Oct 21 11:10:53 UTC 2015
Hi
I have ported OpenJDK Digital I/O to an embedded board with a Freescale
i.MX6 Quad processor.
The board is running under Ubunto Linux.
I have built dio.jar on the board, not with a cross compiler.
When I configure a GPIO pin for output, *GPIOPin.getValue()* always
returns *false*, even if I have called *GPIOPin.setValue(true)* before.
I have connected a LED on this pin and the LED goes on and off as
expected, so GPIOPin.setValue(boolean) works fine.
The JavaDoc
http://docs.oracle.com/javame/8.0/api/dio/api/jdk/dio/gpio/GPIOPin.html#getValue()
<http://docs.oracle.com/javame/8.0/api/dio/api/jdk/dio/gpio/GPIOPin.html#getValue%28%29>
says:
/Returns the current value of this GPIO pin. If the value was not
set previously using setValue() the device configuration-specific
default value is returned. This method can be called on both output
and input pins./
/Returns: //true if this pin is currently high. /
Here the relevant code from my sources:
GPIOPinConfig pinConfig = new GPIOPinConfig.Builder()
.setControllerNumber(0)
.setPinNumber(pinNumber)
.setDirection(GPIOPinConfig.DIR_OUTPUT_ONLY)
.setTrigger(GPIOPinConfig.TRIGGER_NONE)
.setDriveMode(GPIOPinConfig.MODE_OUTPUT_PUSH_PULL)
.setInitValue(true)
.build();
GPIOPin pin = (GPIOPin)DeviceManager.open(GPIOPin.class, pinConfig);
...... in another method ......
pin.setValue(newValue);
...... in another method ......
boolean curValue = pin.getValue(); <<--- always false, even if
newValue was true
Who can help or fix this bug?
Note:
I'm using the latest release from http://hg.openjdk.java.net/dio/dev
With kind regards
Peter Saitz
--
_________________________
Peter Saitz
Software Developer
Savien Technologies GmbH.
Bierhäuselberggasse 31
A-1140 Wien
mailto: peter.saitz at savien.at
phone: +43 699 19650224
More information about the dio-dev
mailing list