예제 #1
0
        /// <summary>
        /// Creates a register with one field, serving a purpose of read and write register.
        /// </summary>
        /// <returns>A new register.</returns>
        /// <param name="resetValue">Reset value.</param>
        /// <param name="name">Ignored parameter, for convenience. Treat it as a comment.</param>
        public static ByteRegister CreateRWRegister(uint resetValue = 0, string name = null)
        {
            //null because parent is used for logging purposes only - this will never happen in this case.
            var register = new ByteRegister(null, resetValue);

            register.DefineValueField(0, register.MaxRegisterLength);
            return(register);
        }
예제 #2
0
 /// <summary>
 /// Fluent API for change callback registration. For description see <see cref="ByteRegister.DefineChangeCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static ByteRegister WithChangeCallback(this ByteRegister register, Action <byte, byte> changeCallback)
 {
     register.DefineChangeCallback(changeCallback);
     return(register);
 }
예제 #3
0
 /// <summary>
 /// Fluent API for write callback registration. For description see <see cref="ByteRegister.DefineWriteCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static ByteRegister WithWriteCallback(this ByteRegister register, Action <byte, byte> writeCallback)
 {
     register.DefineWriteCallback(writeCallback);
     return(register);
 }
예제 #4
0
 /// <summary>
 /// Fluent API for read callback registration. For description see <see cref="ByteRegister.DefineReadCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static ByteRegister WithReadCallback(this ByteRegister register, Action <byte, byte> readCallback)
 {
     register.DefineReadCallback(readCallback);
     return(register);
 }