Esempio n. 1
0
        /// <inheritdoc/>
        public void WriteEx(int slaveAddress, I2cMasterFlags flags, ReadOnlySpan <byte> buffer)
        {
            var ftStatus = FtFunction.FT4222_I2CMaster_WriteEx(FtHandle, (ushort)slaveAddress, (byte)flags, in MemoryMarshal.GetReference(buffer), (ushort)buffer.Length, out _);

            if (ftStatus != FtStatus.Ok)
            {
                throw new IOException($"{nameof(WriteEx)} failed to write, error: {ftStatus}");
            }
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public void ReadEx(int slaveAddress, I2cMasterFlags flags, Span <byte> buffer)
        {
            var result = FtFunction.FT4222_I2CMaster_ReadEx(FtHandle, (ushort)slaveAddress, (byte)flags, in MemoryMarshal.GetReference(buffer), (ushort)buffer.Length, out _);

            if (result != FtStatus.Ok)
            {
                throw new IOException();
            }
        }
Esempio n. 3
0
 /// <inheritdoc/>
 public void WriteEx(I2cMasterFlags flags, ReadOnlySpan <byte> buffer)
 {
     WriteEx(_settings.DeviceAddress, flags, buffer);
 }
Esempio n. 4
0
 /// <inheritdoc/>
 public void ReadEx(I2cMasterFlags flags, Span <byte> buffer)
 {
     ReadEx(_settings.DeviceAddress, flags, buffer);
 }
 /// <summary>Writes data to the I2C device.</summary>
 /// <param name="flags">flags</param>
 /// <param name="buffer">The buffer that contains the data to be written to the I2C device.</param>
 public void WriteEx(I2cMasterFlags flags, ReadOnlySpan <byte> buffer)
 {
     _i2cMaster.WriteEx(_slaveAddress, flags, buffer);
 }
 /// <summary>Reads data from the I2C device.</summary>
 /// <param name="flags">flags</param>
 /// <param name="buffer">The buffer to read the data from the I2C device.</param>
 public void ReadEx(I2cMasterFlags flags, Span <byte> buffer)
 {
     _i2cMaster.ReadEx(_slaveAddress, flags, buffer);
 }