/// <summary> /// Read 1 of 6 available module addresses /// </summary> /// <param name="slot"> /// The slot to read from /// </param> /// <param name="width"> /// The width, in bytes, of the address /// </param> /// <returns>byte[] representing the address</returns> public byte[] GetAddress(AddressSlot slot, byte width) { CheckIsInitialized(); AddressWidth.IsValid(width); var read = Execute(Commands.R_REGISTER, (byte)slot, new byte[width]); var result = new byte[read.Length - 1]; Array.Copy(read, 1, result, 0, result.Length); return(result); }
/// <summary> /// Set one of 6 available module addresses /// </summary> /// <param name="slot"> /// The slot to write the address to /// </param> /// <param name="address"> /// The address to write. Must be between 3 and 5 bytes, otherwise an ArgumentException is thrown. /// </param> public void SetAddress(AddressSlot slot, byte[] address) { CheckIsInitialized(); AddressWidth.IsValid(address); Execute(Commands.W_REGISTER, (byte)slot, address); if (slot == AddressSlot.Zero) { _slot0Address = address; } }