@Override public PinState getState(Pin pin) { return super.getState(pin); }
@Override public PinState getState(Pin pin) { super.getState(pin); // calculate current state from the bitmask value int bit = (int)Math.pow(2, (pin.getAddress()-1)); int state = (currentStates & bit); return (state == bit) ? PinState.HIGH : PinState.LOW; }
@Override public PinState getState(Pin pin) { // call super method to perform validation on pin PinState result = super.getState(pin); // determine pin address int pinAddress = pin.getAddress(); // determine pin state result = (currentStates & pinAddress) == pinAddress ? PinState.HIGH : PinState.LOW; // cache state getPinCache(pin).setState(result); return result; }
@Override public PinState getState(Pin pin) { super.getState(pin); // return pin state PinState state = null; int ret = com.pi4j.wiringpi.Gpio.digitalRead(pin.getAddress()); if (ret >= 0) { state = PinState.getState(ret); } return state; }
@Override public PinState getState(Pin pin) { // call super method to perform validation on pin PinState result = super.getState(pin); // determine A or B port based on pin address if (pin.getAddress() < GPIO_B_OFFSET) { result = getStateA(pin); // get pin state } else { result = getStateB(pin); // get pin state } // return pin state return result; }
@Override public PinState getState(Pin pin) { super.getState(pin); // return pin state PinState state = null; int ret = com.pi4j.wiringpi.Gpio.digitalRead(pin.getAddress()); if (ret >= 0) { state = PinState.getState(ret); } return state; }
@Override public PinState getState(Pin pin) { // call super method to perform validation on pin PinState result = super.getState(pin); // determine A or B port based on pin address if (pin.getAddress() < GPIO_B_OFFSET) { result = getStateA(pin); // get pin state } else { result = getStateB(pin); // get pin state } // return pin state return result; }
@Override public PinState getState(Pin pin) { // call super method to perform validation on pin PinState result = super.getState(pin); // determine A or B port based on pin address if (pin.getAddress() < GPIO_B_OFFSET) { result = getStateA(pin); // get pin state } else { result = getStateB(pin); // get pin state } // return pin state return result; }
@Override public double getValue(Pin pin) { // the getMode() will validate the pin exists with the hasPin() function PinMode mode = getMode(pin); if (mode == PinMode.DIGITAL_OUTPUT) { return getState(pin).getValue(); } // return cached pin analog value return getPinCache(pin).getAnalogValue(); }
@Override public double getValue(Pin pin) { // the getMode() will validate the pin exists with the hasPin() function PinMode mode = getMode(pin); if (mode == PinMode.DIGITAL_OUTPUT) { return getState(pin).getValue(); } // return cached pin analog value return getPinCache(pin).getAnalogValue(); }