예제 #1
0
        /// <summary>
        /// Read int from register.
        /// </summary>
        /// <param name="register">The register.</param>
        /// <returns>An int.</returns>
        public short ReadInt16(SensorRegister register)
        {
            Span <byte> val = stackalloc byte[2];

            this.Read(register, val);
            return(BinaryPrimitives.ReadInt16LittleEndian(val));
        }
예제 #2
0
        /// <summary>
        /// Read int from register.
        /// </summary>
        /// <param name="register">The register.</param>
        /// <returns>An int.</returns>
        public int ReadInt24(SensorRegister register)
        {
            Span <byte> val = stackalloc byte[3];

            this.Read(register, val);
            return(ConvertToInt24LittleEndian(val));
        }
예제 #3
0
 /// <summary>
 /// Write a byte to the specified register.
 /// </summary>
 /// <param name="register">The register.</param>
 /// <param name="data">The data to write.</param>
 public void WriteByte(SensorRegister register, byte data)
 {
     this.WriteByte((byte)register, data);
 }
예제 #4
0
 /// <summary>
 /// Read raw from register.
 /// </summary>
 /// <param name="register">The register.</param>
 /// <returns>A single byte.</returns>
 public byte Read(SensorRegister register)
 {
     return(this.Read((byte)register));
 }
예제 #5
0
 /// <summary>
 /// Read int from register.
 /// </summary>
 /// <param name="register">The register.</param>
 /// <param name="buffer">the buffer to read.</param>
 public void Read(SensorRegister register, Span <byte> buffer)
 {
     this.Read((byte)register, buffer);
 }