internal I2CEventArgs(I2CReply value) { _value = value; }
private FirmataMessage CreateI2CReply() { var reply = new I2CReply { Address = _messageBuffer[2] | (_messageBuffer[3] << 7), Register = _messageBuffer[4] | (_messageBuffer[5] << 7) }; var data = new byte[(_messageBufferIndex - 5) / 2]; for (int x = 0; x < data.Length; x++) { data[x] = (byte)(_messageBuffer[x * 2 + 6] | _messageBuffer[x * 2 + 7] << 7); } reply.Data = data; if (I2CReplyReceived != null) I2CReplyReceived(this, new I2CEventArgs(reply)); return new FirmataMessage(reply, MessageType.I2CReply); }