/// <summary> /// Returns the State of the out bits as Byte /// </summary> /// <returns>state of out bit as byte</returns> public byte GetBitStateAsByte() { byte portMaskState = 0x00; foreach (var bit in PortBits) { var value = PortBit.ConvertToInt(bit.BitOut); var bitNum = bit.BitNumber; portMaskState |= (byte)(value << bitNum); } return(portMaskState); }
private void InitPort() { if (PortBits == null) { PortBits = new List <PortBit>(); } for (var i = 0; i < Defines.MaxBitNumber + 1; i++) { var bit = new PortBit(i); bit.ChangeIn += BitInChange; bit.ChangeOut += BitOutChange; PortBits.Add(bit); } }
private void Device_PortBitOutChange(Device device, Port port, PortBit portbit) { _isDataWrite = true; }
private void PortBitOutChangeEvent(PortBit portbit) { PortBitOutChange?.Invoke(this, portbit); }
private void BitOutChange(PortBit portbit) { PortBitOutChangeEvent(portbit); }