public void setProgrammableGainAmplifier(ProgrammableGainAmplifierValue pga, GpioPin...pin){ for(GpioPin p : pin){ this.pga[p.getPin().getAddress()] = pga; } }
public EasyDriver(Pin stepPin) { mDrivingMode = ONE_EIGHTH_STEP; final GpioController gpio = GpioFactory.getInstance(); // provision gpio pin #01 as an output pin and turn on mStepPin = gpio.provisionDigitalOutputPin(stepPin, "MyLED", PinState.LOW); }
@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(); }
public void shutdown() { final GpioController gpio = GpioFactory.getInstance(); gpio.shutdown(); }
@Override public void setPullResistance(Pin pin, PinPullResistance resistance) { super.setPullResistance(pin, resistance); com.pi4j.wiringpi.Gpio.pullUpDnControl(pin.getAddress(), resistance.getValue()); }
@Override public PinMode getMode(Pin pin) { super.getMode(pin); // return first mode found; this device has singular fixed pin modes for(PinMode mode : pin.getSupportedPinModes()) return mode; return null; }
public void setAnalogValue(Pin pin, double value) { // cache pin state getPinCache(pin).setAnalogValue(value); // dispatch event dispatchPinAnalogValueChangeEvent(pin, value); }
@Override public void addListener(Pin pin, PinListener listener) { super.addListener(pin, listener); // update the native interrupt listener thread for callbacks updateInterruptListener(pin); }
@Override public boolean isExported(Pin pin) { // Odroid AIN pins are not exported if (getMode(pin) == PinMode.ANALOG_INPUT) { return false; } return super.isExported(pin); }
@Override public void removeListener(Pin pin, PinListener listener) { super.removeListener(pin, listener); // update the native interrupt listener thread for callbacks updateInterruptListener(pin); }
@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 void addListener(Pin pin, PinListener listener) { super.addListener(pin, listener); // update the native interrupt listener thread for callbacks updateInterruptListener(pin); }