reconfigureInput method

void reconfigureInput({
  1. Bias? bias,
  2. ActiveState activeState = ActiveState.high,
})

Reconfigures the line as input with the given configuration.

If FlutterGpiod.supportsBias is false, bias must be null, otherwise a UnsupportedError will be thrown.

This will throw a UnsupportedError if FlutterGpiod.supportsLineReconfiguration is false.

You can't specify triggers here because of platform limitations.

Implementation

void reconfigureInput({Bias? bias, ActiveState activeState = ActiveState.high}) {
  ArgumentError.checkNotNull(activeState, "activeState");
  _checkSupportsBiasValue(bias);
  _checkSupportsLineReconfiguration();

  // we only change the info, not the ownership
  _info = null;
  _value = null;

  if (!_requested) {
    throw StateError("Can't reconfigured line because it is not requested.");
  }

  PlatformInterface.instance.reconfigureLine(
    lineHandle: _lineHandle,
    direction: LineDirection.input,
    bias: bias,
    activeState: activeState,
  );

  _info = PlatformInterface.instance.getLineInfo(_lineHandle);
}