public HSREL5 CreateHSREL5(Enum id, int address) { var device = new HSREL5(id.ToString(), address, _i2CBus, _notificationHandler); _ioBoardManager.Add(id, device); return device; }
public HSREL5 CreateHSREL5(Enum id, I2CSlaveAddress i2CAddress) { var device = new HSREL5(DeviceIdFactory.CreateIdFrom(id), i2CAddress, _i2CBus); _controller.AddDevice(device); return(device); }
public HSREL5 RegisterHSREL5(Enum id, I2CSlaveAddress i2CAddress) { var device = new HSREL5(DeviceIdFactory.CreateIdFrom(id), i2CAddress, _i2CBusService); _deviceService.AddDevice(device); return(device); }
public HSREL5 RegisterHSREL5(string id, I2CSlaveAddress i2CAddress) { var device = new HSREL5(id, i2CAddress, _i2CBusService, _deviceMessageBrokerService, _log); _deviceService.AddDevice(device); return(device); }
public void CCTools_Write_HSRel5_State() { var i2CBus = new TestI2CBusService(); var hsrel5 = new HSREL5(DeviceIdFactory.EmptyId, new I2CSlaveAddress(66), i2CBus); hsrel5[HSREL5Pin.Relay0].Write(BinaryState.High); Assert.AreEqual(new I2CSlaveAddress(66), i2CBus.LastUsedI2CSlaveAddress); Assert.AreEqual(1, i2CBus.I2CDevice.LastWrittenBytes.Length); // The bits are inverted using a hardware inverter. This requires checking // against inverted values too. Assert.AreEqual(254, i2CBus.I2CDevice.LastWrittenBytes[0]); hsrel5[HSREL5Pin.Relay4].Write(BinaryState.High); Assert.AreEqual(new I2CSlaveAddress(66), i2CBus.LastUsedI2CSlaveAddress); Assert.AreEqual(1, i2CBus.I2CDevice.LastWrittenBytes.Length); // The bits are inverted using a hardware inverter. This requires checking // against inverted values too. Assert.AreEqual(238, i2CBus.I2CDevice.LastWrittenBytes[0]); }
public HSREL5 RegisterHSREL5(Enum id, I2CSlaveAddress i2CAddress) { var device = new HSREL5(DeviceIdFactory.CreateIdFrom(id), i2CAddress, _i2CBusService); _deviceService.AddDevice(device); return device; }
private void SetupFan(StateMachine stateMachine, HSREL5 hsrel5) { var fanPort0 = hsrel5.GetOutput(4); var fanPort1 = hsrel5.GetOutput(5); stateMachine.AddOffState().WithOutput(fanPort0, BinaryState.Low).WithOutput(fanPort1, BinaryState.Low); stateMachine.AddState(new ComponentState("1")).WithOutput(fanPort0, BinaryState.High).WithOutput(fanPort1, BinaryState.Low); stateMachine.AddState(new ComponentState("2")).WithOutput(fanPort0, BinaryState.High).WithOutput(fanPort1, BinaryState.High); stateMachine.TryTurnOff(); }