public bool ReadDigital(DigitalPin pin) {
if (!Enum.IsDefined(typeof(DigitalPin), pin)) throw new ArgumentException(nameof(pin));
var gpioPin = pin == DigitalPin.DIO16 ? this.dio16 : this.dio26;
if (gpioPin.GetDriveMode() != GpioPinDriveMode.Input)
gpioPin.SetDriveMode(GpioPinDriveMode.Input);
return gpioPin.Read() == GpioPinValue.High;
}