protected int Execute(I2CDevice.I2CTransaction action) { lock (_bus) { return(_bus.Execute(_config, new[] { action }, _timeoutMilliseconds)); } }
public void Write(byte[] state) { if (state == null) { throw new ArgumentNullException(nameof(state)); } if (state.Length != StateSize) { throw new ArgumentException("Length is invalid.", nameof(state)); } _i2CBus.Execute(_address, bus => bus.Write(state)); }
public void Write(byte[] state) { if (state == null) { throw new ArgumentNullException(nameof(state)); } if (state.Length != StateSize) { throw new ArgumentException("Length is invalid.", nameof(state)); } // TODO: Check error handling here if device is currently not available. _i2CBus.Execute(_address, bus => bus.Write(state)); }
public HSPE16InputOnly(DeviceId id, I2CSlaveAddress address, II2CBus i2cBus, IHttpRequestController httpApi, ILogger logger) : base(id, new MAX7311Driver(address, i2cBus), httpApi, logger) { byte[] setupAsInputs = { 0x06, 0xFF, 0xFF }; i2cBus.Execute(address, b => b.Write(setupAsInputs)); FetchState(); }
public HSPE16InputOnly(DeviceId id, I2CSlaveAddress address, II2CBus i2cBus) : base(id, new MAX7311Driver(address, i2cBus)) { byte[] setupAsInputs = { 0x06, 0xFF, 0xFF }; i2cBus.Execute(address, b => b.Write(setupAsInputs)); FetchState(); }
public void ExecuteCommand(I2CHardwareBridgeCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } _i2CBus.Execute(_address, command.Execute, false); }
public void Write(byte[] state) { if (state == null) { throw new ArgumentNullException(nameof(state)); } if (state.Length != StateSize) { throw new ArgumentException("Length is invalid.", nameof(state)); } byte[] setConfigurationToOutput = { ConfigurationRegisterA, 0, 0 }; byte[] setState = { OutputPortRegisterA, state[0], state[1] }; _i2CBus.Execute(_address, bus => { bus.Write(setConfigurationToOutput); bus.Write(setState); }); }
public void Write(byte[] state) { if (state == null) { throw new ArgumentNullException(nameof(state)); } if (state.Length != StateSize) { throw new ArgumentException("Length is invalid.", nameof(state)); } // TODO: Check error handling here if device is currently not available. byte[] setConfigurationToOutput = { ConfigurationRegisterA, 0, 0 }; byte[] setState = { OutputPortRegisterA, state[0], state[1] }; _i2CBus.Execute(_address, bus => { bus.Write(setConfigurationToOutput); bus.Write(setState); }); }
public void Execute(II2cDeviceCommand command) { bus.Execute(address, command.Execute, true); }