public void SetPinMode(int pin, PinMode mode) { if (mode == PinMode.Output) { Directions |= PowerOf2[pin]; } else { Directions &= ~PowerOf2[pin]; } var result = LibMpsse.FT_WriteGPIO(_i2cHandle, (short)Directions, (short)Values); if (result != FtdiMpsseI2CResult.Ok) { throw new GpioException(result, nameof(SetPinMode)); } }
public void DigitalWrite(int pin, PinState state) { if (state == PinState.High) { this.Values |= PowerOf2[pin]; } else { Values &= ~PowerOf2[pin]; } var result = LibMpsse.FT_WriteGPIO(_i2cHandle, (short)Directions, (short)Values); if (result != FtdiMpsseI2CResult.Ok) { if (Debugger.IsAttached) { Debugger.Break(); } throw new GpioException(result, nameof(DigitalWrite)); } }
protected FtdiMpsseI2CResult WriteGPIOMask(byte directions, byte values) { Values = values; Directions = directions; return(LibMpsse.FT_WriteGPIO(_i2cHandle, directions, values)); }
protected FtdiMpsseI2CResult WriteGPIOMask(byte values) { return(LibMpsse.FT_WriteGPIO(_i2cHandle, 0, values)); }